Bash Shortcuts

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

1. Command Editing

1.1. Move

1.1.1. Ctrl + e – go to the end

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

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

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

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

1.1.6. Ctrl + f – forward one character

1.1.7. Ctrl + b – backward one character

1.2. Delete

1.2.1. Ctrl + k – to the end

1.2.2. Ctrl + u – to the start

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

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

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

1.2.6. Ctrl + d – delete character under the cursor

1.2.7. Ctrl + h – delete character before the cursor

1.3. Other

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

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

1.3.3. Alt + t – swap current word with previous

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

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

2. Command Recall

2.1. Ctrl + r – search the history backwards

2.2. Ctrl + g – escape from history searching mode

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

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

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

3. Bash Bang (!) Commands

3.1. !! – run last command

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

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

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

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

3.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‘)

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

4. Command Control

4.1. Ctrl + l – clear the screen

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

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

4.4. Ctrl + c – terminate the command

4.5. Ctrl + z – suspend/stop the command