logoalt Hacker News

hikarudotoday at 9:57 AM1 replyview on HN

One trick I use all the time:

You're typing a long command, then before running it you remember you have to do some stuff first. Instead of Ctrl-C to cancel it, you push it to history in a disabled form.

Prepend the line with # to comment it, run the commented line so it gets added to history, do whatever it is you remembered, then up arrow to retrieve the first command.

$ long_command

<Home, #>

$ #long_command

<Enter>

$ stuff_1 $ stuff_2

<Up arrow a few times>

$ #long_command

<home, del>

$ long_command


Replies

fragmedetoday at 10:07 AM

Fwiw, in Bash, alt-shift-3 will prepend the current command with # and start a new command.

show 1 reply