Bash Shortcuts

Get Started. It's Free
or sign up with your email address
Bash Shortcuts by Mind Map: Bash Shortcuts

1. Command Recall

1.1. Ctrl + r – search the history backwards

1.2. Ctrl + g – escape from history searching mode

1.3. Ctrl + p – previous command in history (i.e. walk back through the command history)

1.4. Ctrl + n – next command in history (i.e. walk forward through the command history)

1.5. Alt + . – use the last word of the previous command

2. Bash Bang (!) Commands

2.1. !! – run last command

2.2. !blah – run the most recent command that starts with ‘blah’ (e.g. !ls)

2.3. !blah:p – print out the command that !blah would run (also adds it as the latest command in the command history)

2.4. !$ – the last word of the previous command (same as Alt + .)

2.5. !$:p – print out the word that !$ would substitute

2.6. !* – the previous command except for the last word (e.g. if you type ‘find some_file.txt /‘, then !* would give you ‘find some_file.txt‘)

2.7. !*:p – print out what !* would substitute

3. Command Control

3.1. Ctrl + l – clear the screen

3.2. Ctrl + s – stops the output to the screen (for long running verbose command)

3.3. Ctrl + q – allow output to the screen (if previously stopped using command above)

3.4. Ctrl + c – terminate the command

3.5. Ctrl + z – suspend/stop the command

4. Command Editing

4.1. Move

4.1.1. Ctrl + e – go to the end

4.1.2. Ctrl + a – go to the start of the command line

4.1.3. Ctrl + xx – between start of command line and current cursor position

4.1.4. Alt + b – backward one word (or go to start of word the cursor is

4.1.5. Alt + f – forward one word (or go to end of word the cursor is currently on)

4.1.6. Ctrl + f – forward one character

4.1.7. Ctrl + b – backward one character

4.2. Delete

4.2.1. Ctrl + k – to the end

4.2.2. Ctrl + u – to the start

4.2.3. Ctrl + w – from cursor to start of word

4.2.4. Ctrl + y – paste word or text that was cut using one of the deletion shortcuts

4.2.5. Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)

4.2.6. Ctrl + d – delete character under the cursor

4.2.7. Ctrl + h – delete character before the cursor

4.3. Other

4.3.1. Alt + u – make uppercase from cursor to end of word

4.3.2. Alt + l – make lowercase from cursor to end of word

4.3.3. Alt + t – swap current word with previous

4.3.4. Ctrl + t – swap character under cursor with the previous one

4.3.5. Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word)