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.

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.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.