Command-L “Clear to the previous mark” equivalent in iTerm2












4















In Mac OSX there is the command-L command to "clear to the previous mark"



I was curious if there is a command equivalent to this in the iTerm2 terminal because I would like to switch over, but I use this command a lot in the normal terminal.



Thank you for the help.










share|improve this question


















  • 2





    what is previous mark?

    – Ken Ratanachai S.
    Mar 23 '17 at 23:12











  • stackoverflow.com/questions/9679776/…

    – aibotnet
    Jul 16 '17 at 0:44











  • Sounds like a known issue superuser.com/questions/1178934/…

    – primohacker
    Jan 24 at 1:33











  • see also stackoverflow.com/questions/15733312/iterm2-delete-line

    – primohacker
    Jan 24 at 1:38
















4















In Mac OSX there is the command-L command to "clear to the previous mark"



I was curious if there is a command equivalent to this in the iTerm2 terminal because I would like to switch over, but I use this command a lot in the normal terminal.



Thank you for the help.










share|improve this question


















  • 2





    what is previous mark?

    – Ken Ratanachai S.
    Mar 23 '17 at 23:12











  • stackoverflow.com/questions/9679776/…

    – aibotnet
    Jul 16 '17 at 0:44











  • Sounds like a known issue superuser.com/questions/1178934/…

    – primohacker
    Jan 24 at 1:33











  • see also stackoverflow.com/questions/15733312/iterm2-delete-line

    – primohacker
    Jan 24 at 1:38














4












4








4








In Mac OSX there is the command-L command to "clear to the previous mark"



I was curious if there is a command equivalent to this in the iTerm2 terminal because I would like to switch over, but I use this command a lot in the normal terminal.



Thank you for the help.










share|improve this question














In Mac OSX there is the command-L command to "clear to the previous mark"



I was curious if there is a command equivalent to this in the iTerm2 terminal because I would like to switch over, but I use this command a lot in the normal terminal.



Thank you for the help.







keyboard-shortcuts hotkeys iterm2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 '17 at 23:01









Avir94Avir94

211




211








  • 2





    what is previous mark?

    – Ken Ratanachai S.
    Mar 23 '17 at 23:12











  • stackoverflow.com/questions/9679776/…

    – aibotnet
    Jul 16 '17 at 0:44











  • Sounds like a known issue superuser.com/questions/1178934/…

    – primohacker
    Jan 24 at 1:33











  • see also stackoverflow.com/questions/15733312/iterm2-delete-line

    – primohacker
    Jan 24 at 1:38














  • 2





    what is previous mark?

    – Ken Ratanachai S.
    Mar 23 '17 at 23:12











  • stackoverflow.com/questions/9679776/…

    – aibotnet
    Jul 16 '17 at 0:44











  • Sounds like a known issue superuser.com/questions/1178934/…

    – primohacker
    Jan 24 at 1:33











  • see also stackoverflow.com/questions/15733312/iterm2-delete-line

    – primohacker
    Jan 24 at 1:38








2




2





what is previous mark?

– Ken Ratanachai S.
Mar 23 '17 at 23:12





what is previous mark?

– Ken Ratanachai S.
Mar 23 '17 at 23:12













stackoverflow.com/questions/9679776/…

– aibotnet
Jul 16 '17 at 0:44





stackoverflow.com/questions/9679776/…

– aibotnet
Jul 16 '17 at 0:44













Sounds like a known issue superuser.com/questions/1178934/…

– primohacker
Jan 24 at 1:33





Sounds like a known issue superuser.com/questions/1178934/…

– primohacker
Jan 24 at 1:33













see also stackoverflow.com/questions/15733312/iterm2-delete-line

– primohacker
Jan 24 at 1:38





see also stackoverflow.com/questions/15733312/iterm2-delete-line

– primohacker
Jan 24 at 1:38










1 Answer
1






active

oldest

votes


















0














Clear the screen/pane (when Ctrl + L won't work) ⌘ + K



Here's a cheatsheet for iTerm2.



Honestly, I think clearing lines this way is a bad habit. It's not universal.



If you have a injected proc in metasploit with a terminal, and you hit your habitual keyboard interrupt sequence of choice.... Well, keyboard interrupt in this context will kill your shell and could kick you out of the injected process. (So much for your exploit. Sure hope someone restarts that box without getting suspicious...) It took me a year to get out of this habit and I still catch myself. Same problems with commands that don't terminate on their own like ping without specifying a count. Do that in metasploit without doing ping -c 4 <ip> and you'll remember how screwed you are because you have to do an interrupt to stop it, and that interrupt will kill your session.



Instead, I would recommend using the home key, entering a comment character, then enter. This has the added benefit of saving the long line in history. You worked hard to type that line. There's probably some goodness in there you might need later. And, once in your history, you can arrow up to it and simply home and delete the # character. Think of it like an arm/disarm toggle.



In bash that would be home and #. Oddly enough, I don't see a comment character for iTerm2...



Anyhow, when Ctrl + L does't work) try ⌘ + K. Considering using home comment char enter instead.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1191799%2fcommand-l-clear-to-the-previous-mark-equivalent-in-iterm2%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Clear the screen/pane (when Ctrl + L won't work) ⌘ + K



    Here's a cheatsheet for iTerm2.



    Honestly, I think clearing lines this way is a bad habit. It's not universal.



    If you have a injected proc in metasploit with a terminal, and you hit your habitual keyboard interrupt sequence of choice.... Well, keyboard interrupt in this context will kill your shell and could kick you out of the injected process. (So much for your exploit. Sure hope someone restarts that box without getting suspicious...) It took me a year to get out of this habit and I still catch myself. Same problems with commands that don't terminate on their own like ping without specifying a count. Do that in metasploit without doing ping -c 4 <ip> and you'll remember how screwed you are because you have to do an interrupt to stop it, and that interrupt will kill your session.



    Instead, I would recommend using the home key, entering a comment character, then enter. This has the added benefit of saving the long line in history. You worked hard to type that line. There's probably some goodness in there you might need later. And, once in your history, you can arrow up to it and simply home and delete the # character. Think of it like an arm/disarm toggle.



    In bash that would be home and #. Oddly enough, I don't see a comment character for iTerm2...



    Anyhow, when Ctrl + L does't work) try ⌘ + K. Considering using home comment char enter instead.






    share|improve this answer






























      0














      Clear the screen/pane (when Ctrl + L won't work) ⌘ + K



      Here's a cheatsheet for iTerm2.



      Honestly, I think clearing lines this way is a bad habit. It's not universal.



      If you have a injected proc in metasploit with a terminal, and you hit your habitual keyboard interrupt sequence of choice.... Well, keyboard interrupt in this context will kill your shell and could kick you out of the injected process. (So much for your exploit. Sure hope someone restarts that box without getting suspicious...) It took me a year to get out of this habit and I still catch myself. Same problems with commands that don't terminate on their own like ping without specifying a count. Do that in metasploit without doing ping -c 4 <ip> and you'll remember how screwed you are because you have to do an interrupt to stop it, and that interrupt will kill your session.



      Instead, I would recommend using the home key, entering a comment character, then enter. This has the added benefit of saving the long line in history. You worked hard to type that line. There's probably some goodness in there you might need later. And, once in your history, you can arrow up to it and simply home and delete the # character. Think of it like an arm/disarm toggle.



      In bash that would be home and #. Oddly enough, I don't see a comment character for iTerm2...



      Anyhow, when Ctrl + L does't work) try ⌘ + K. Considering using home comment char enter instead.






      share|improve this answer




























        0












        0








        0







        Clear the screen/pane (when Ctrl + L won't work) ⌘ + K



        Here's a cheatsheet for iTerm2.



        Honestly, I think clearing lines this way is a bad habit. It's not universal.



        If you have a injected proc in metasploit with a terminal, and you hit your habitual keyboard interrupt sequence of choice.... Well, keyboard interrupt in this context will kill your shell and could kick you out of the injected process. (So much for your exploit. Sure hope someone restarts that box without getting suspicious...) It took me a year to get out of this habit and I still catch myself. Same problems with commands that don't terminate on their own like ping without specifying a count. Do that in metasploit without doing ping -c 4 <ip> and you'll remember how screwed you are because you have to do an interrupt to stop it, and that interrupt will kill your session.



        Instead, I would recommend using the home key, entering a comment character, then enter. This has the added benefit of saving the long line in history. You worked hard to type that line. There's probably some goodness in there you might need later. And, once in your history, you can arrow up to it and simply home and delete the # character. Think of it like an arm/disarm toggle.



        In bash that would be home and #. Oddly enough, I don't see a comment character for iTerm2...



        Anyhow, when Ctrl + L does't work) try ⌘ + K. Considering using home comment char enter instead.






        share|improve this answer















        Clear the screen/pane (when Ctrl + L won't work) ⌘ + K



        Here's a cheatsheet for iTerm2.



        Honestly, I think clearing lines this way is a bad habit. It's not universal.



        If you have a injected proc in metasploit with a terminal, and you hit your habitual keyboard interrupt sequence of choice.... Well, keyboard interrupt in this context will kill your shell and could kick you out of the injected process. (So much for your exploit. Sure hope someone restarts that box without getting suspicious...) It took me a year to get out of this habit and I still catch myself. Same problems with commands that don't terminate on their own like ping without specifying a count. Do that in metasploit without doing ping -c 4 <ip> and you'll remember how screwed you are because you have to do an interrupt to stop it, and that interrupt will kill your session.



        Instead, I would recommend using the home key, entering a comment character, then enter. This has the added benefit of saving the long line in history. You worked hard to type that line. There's probably some goodness in there you might need later. And, once in your history, you can arrow up to it and simply home and delete the # character. Think of it like an arm/disarm toggle.



        In bash that would be home and #. Oddly enough, I don't see a comment character for iTerm2...



        Anyhow, when Ctrl + L does't work) try ⌘ + K. Considering using home comment char enter instead.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 24 at 1:58

























        answered Jan 24 at 1:50









        primohackerprimohacker

        7619




        7619






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1191799%2fcommand-l-clear-to-the-previous-mark-equivalent-in-iterm2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

             ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕