If you want to get truly fast in the Linux Bash shell, stop thinking in commands alone and start doing trivial command tasks by thinking it in keystrokes !
The biggest productivity gains don’t come only by learning new tools, they come from navigating and reusing what is embedded as default functionality, like editing commands , searching through them and shortcuts to run and reuse instantly without need to type again and again.
At the center of this approach is one habit, to try to never type the same command twice.
1. The Allmighty, Reverse Search (
Ctrl + R
)
If you learn only one shortcut for a begginning say hello to the King of all bash shortcut commands CTRL + R.
Press:
Ctrl + R
Then start typing part of a previous command. Bash will search your history in real time and show the most recent match.
Example:
(reverse-i-search)`ssh': ssh user@server
Press:
To cycle further one command match back:
Ctrl + R
again
Edit before running use:
→
(right arrow)
To run found cmd simply press
Enter.
This is dramatically faster than scrolling through history or retyping long commands. Over time, your shell history becomes a searchable command database.
2. Stop annoying re-typing: navigate the Line instantly
When editing a command, don’t hold arrow keys—jump instead:
Go to the beginning of line
Ctrl + A
Move to the end of command string:
Ctrl + E
Jump back one word
Alt + B
Jump forward one word ahead
Alt + F
These shortcuts let you fix mistakes or modify long commands in seconds.
3. Precise Delete strings
Precise deletion is just as important as movement:
Delete everything before cursor position:
Ctrl + U
Delete everything after cursor position:
Ctrl + K
Delete previous word from cmd string:
Ctrl + W
Delete next word in command string
Alt + D
Instead of holding backspace, you surgically remove chunks of text.
4. Reuse arguments without rewriting
Bash has built-in shortcuts for reusing parts of previous commands:
Repeat last command, type in shell
!!
Last argument of previous command
!$
Add all arguments from previous command to a command
!*
For example on use last argument from previous command:
mkdir projectcd !$
This jumps into the directory you just created without retyping its name.
hipo@jeremiah:/usr/local/bin$ find . /usr/local/bin/ /bin/ /usr/bin -iname 'ls'
/bin/ls
/usr/bin/ls
hipo@jeremiah:/usr/local/bin$ echo !*
echo . /usr/local/bin/ /bin/ /usr/bin -iname 'ls'
To only get the file name of
5. Fix Mistakes Instantly hack
Made a typo? You don’t need to retype the whole command.
Use the shortcut:
^old^new
Example:
hipo@jeremiah:~$ ls -al /bin/slls: cannot access '/bin/sl': No such file or directoryhipo@jeremiah: ~$ ^sl^lsls -al /bin/ls-rwxr-xr-x 1 root root 151344 Sep 20 2022 /bin/ls
Bash reruns the previous command with the correction applied.
6. Use history without running history cmd
The quick access to last and previous commands, is perhaps known by most but for novice people starting will shell it is worthy mention:
Scroll through commands:
Keyboard Arrow Up / Down keys
↑ / ↓
run command number n from history
!n
:
To re-run cmd from history line 10
$ !10
To lets say you want to get last 10 commands from history:
$ history10
Instead of getting full comand history with
$ history
Use the
Ctrl + R
which is faster shortcut to arrow keys and walking through history.
7. Use Auto-Complete
The good old well known
Tab
key is well known one by almost all sysadmins, but I’ll mention it anyways.
Auto-complete file / command
Single
Tab press
Show all matches
Press
Tab
twice
This reduces typing and prevents errors – especially with long file paths.
8. Edit the previous command straight in editor
For complex commands, use:
Ctrl + X, Ctrl + E
This opens your last command in your default editor. You can comfortably edit multi-line or complicated commands, then save and execute.
9. Clear and Reset Quickly
Clear the screen (same as
clear
):
Ctrl + L
Cancel current command:
Ctrl + C
Exit shell:
Ctrl + D
These keep your terminal clean and under control.
10. Background and Foreground Control
You can manage running processes with the keyboard too:
Pause (suspend) active running process on cmd line:
Ctrl + Z
Resume process in background:
$ bg
Bring back to foreground:
$ fg
This is especially useful when you accidentally start something in the foreground.
11. Memorize shortcuts / improve shell habits
When these shortcuts become automatic, habit for you will soon reap the benefits.
You will then no longer need to, constantly retype long command lines, you will not loose time to point with the mouse, you save time on editing your command line:
Of course getting it as habit will take few hours to a day.
Start with just building two habits:
-
Use
Ctrl + Rinstead of retyping -
Use
Ctrl + A/Ctrl + Einstead of arrow keys
Once those stick, layer in the others.
12. Start using fzf fuzzy finder command utility
To get even better command line search and easier manage things with command line binds use fzf.
# apt install –yes fzf
$ source /usr/share/doc/fzf/examples/key-bindings.bash
The fzf command-line tool enhances Linux terminal productivity by replacing the standard, rigid
Ctrl+R
history search with interactive, real-time fuzzy matching.
It offers a visual interface for searching command history, file paths via
Ctrl+T
, and directories using
Alt+C
[Source]. Installing fzf enables a highly efficient workflow, allowing users to find and execute commands faster.
For a complete use cases check GitHub fzf page.
Final Thought
Efficient command line use in Bash is not only about doing less typing, it is about doing more work with less effort, so you can have more time for the important stuff.
The keyboard shortcuts are already there for long time and computer hackers (i mean old school system programmers) has been using them for ages not only in bash but in ksh, zsh, csh and waiting to remove friction from everything you do.
Master them, and the shell stops being a place where you type in like a secretary, but a enjoyable more fun place to spend time on.






