Bash CTRL Keys Cheat Sheet For Linux and Unix Terminal

Found on reddit.

I use Ctrl + r, Ctrl + l and Ctrl + d a lot.

And I hate Ctrl + s - always hit it by mistake. Good to remember Ctrl + q in that case.

Whats your favorites?

6 Likes

I use Ctrl + a and Ctrl + e a lot, especially if I forget to begin with “sudo”.

I just noticed Ctrl + c isn’t listed, unless it’s the same as Ctrl + s.

1 Like

No Ctrl+C is not the same as Ctrl+s
Ctrl+C is for killing process running in the terminal, while Ctrl+S just stop all output to the screen.

1 Like

Speaking of bash, the cli way to clear bash_history is:

history -c && history -w

I found this on DistroWatch some time ago and made note of it.

Jesse wrote:

  • To both wipe the contents of your shell’s history from memory and from the .bash_history file you need to first clear your history from memory and then write the blank history to disk. To do this you can run: history -c && history -w

  • Some people might be wondering why those two commands cannot simply be combined, using “history -cw”. I haven’t looked into the details as to why this doesn’t work, but I can confirm it will not have the desired effect. Perhaps it is a bug or the history command may write its memory to disk before wiping memory. Either way, be sure to split the history purge commands into two parts as shown above.

I see that C-r now has history search (fzf) superpowers, and C-t has changed to a file search with superpowers (fzf).

My favorites are C-a and C-e :sweat_smile:

1 Like