Bash Shortcuts Every Linux User Needs to Know
Linux bash shortcut – tab key
The first shortcut we will discuss is the Tab key. The Tab key is used for one main purpose in bash: completion.
Completion is a feature that allows you to type in the first few letters of a command, filename, or directory name and then hit the Tab key to automatically complete the rest. This can be a huge time saver, especially when you are working with long filenames or complex directory structures.
When you are typing a command, you can hit the Tab key to automatically complete the command or show a list of commands that start with the letters you have typed so far. This can be very useful when you forget the exact name of a command or when you want to see a list of all the available commands that start with a certain letter.
Linux bash shortcut – ctrl + r
The next shortcut we will discuss is Ctrl + r. This shortcut allows you to search through your command history. To use this shortcut, simply type in Ctrl + R and then start typing the letters of the command you are looking for. This is a great way to find a command you have used in the past but can’t remember exactly what it was.
Linux bash shortcut – ctrl + e
The next shortcut we will discuss is Ctrl + e. This shortcut allows you to move the cursor to the end of the line. This can be very useful when you want to add something to the end of a long command or filename.
Linux bash shortcut – ctrl + u
The next shortcut we will discuss is Ctrl + u. This shortcut allows you to delete everything from the cursor position to the beginning of the line. This can be very useful when you want to erase a mistake you made in a command or filename.
Linux bash shortcut – ctrl + b
The next shortcut we will discuss is Ctrl + b. This shortcut allows you to move the cursor back one character. This can be extremely useful when you want to make a change in the middle of a long command or filename.
Linux bash shortcut – ctrl + f
The next shortcut we will discuss is Ctrl + f. This shortcut allows you to move the cursor forward one character. This can be especially useful when you want to make a change in the middle of a long command or filename.
Linuxbash shortcut – ctrl + w
The next shortcut we will discuss is Ctrl + w. This shortcut allows you to delete the word before the cursor. This can be extremely useful when you want to delete a mistake you made in a command or filename.
Linux bash shortcut – ctrl + a
The next shortcut we will discuss is Ctrl + a. This shortcut allows you to move the cursor to the beginning of the current line. This can be very useful when you are typing a long command and want to go back and edit something at the beginning.
Linux bash shortcut – ctrl + c
The last shortcut we will discuss is Ctrl + c. This shortcut is used to cancel the currently running command. This can be very useful if you accidentally start a long-running command or if you want to stop a command that is taking too long to run.
Bash shortcut – Navigation
Ctrl + a Go to the beginning of the line.
Ctrl + e Go to the end of the line.
Alt + f Move the cursor forward one word.
Alt + b Move the cursor back one word.
Ctrl + f Move the cursor forward one character.
Ctrl + b Move the cursor back one character.
Ctrl + x, x Toggle between the current cursor position and the beginning of the line.
Bash shortcut – Editing
Ctrl + _ Undo! (And, yes, that’s an underscore, so you’ll need to use Shift as well.)
Ctrl + x, Ctrl + e Edit the current command in your $EDITOR.
Alt + d Delete the word after the cursor.
Alt + Delete Delete the word before the cursor.
Ctrl + d Delete the character beneath the cursor.
Ctrl + h Delete the character before the cursor (like backspace).
Ctrl + k Cut the line after the cursor to the clipboard.
Ctrl + u Cut the line before the cursor to the clipboard.
Ctrl + d Cut the word after the cursor to the clipboard.
Ctrl + w Cut the word before the cursor to the clipboard.
Ctrl + y Paste the last item to be cut.
Bash shortcut – Processes
Ctrl + l Clear the entire screen (like the clear command).
Ctrl + z Place the currently running process into a suspended background process (and then use fg to restore it).
Ctrl + c Kill the currently running process by sending the SIGINT signal.
Ctrl + d Exit the current shell.
Bash shortcut – History
Ctrl + r Bring up the history search.
Ctrl + g Exit the history search.
Ctrl + p See the previous command in the history.
Ctrl + n See the next command in the history.
How to run a command in the background?
You can use the & symbol at the end of a command to run it in the background. For example, if you want to run the `sleep` command in the background, you would type `sleep 100 &`.
How to view all running processes?
You can use the `ps` command to view all running processes. For example, `ps aux` will show all processes running on the system, including the command used to start them.
How to kill a running process?
You can use the `kill` command to kill a running process. For example, if you want to kill the `sleep` command that we ran in the background, you would type `kill %sleep`.
Last updated