Executing Commands Using the Bash Shell Shortcuts

Executing Commands Using the Bash Shell Shortcuts

Tab completion

Tab completion allows a user to quickly complete commands or file names once they have typed
enough at the prompt to make it unique. If the characters typed are not unique, pressing the Tab
key twice displays all commands that begin with the characters already typed.

 

Tab completion can be used to complete file names when typing them as arguments to commands.
When Tab is pressed, it will complete the file name as much as it can. Pressing Tab
a second time causes the shell to list all of the files that are matched by the current pattern.

Command history

The history command displays a list of previously executed commands prefixed with a
command number.

The arrow keys can be used to navigate through previous command lines in the shell’s history. Up
Arrow edits the previous command in the history list. Down Arrow edits the next command in
the history list. Use this key when the Up Arrow has been pressed too many times. Left Arrow
and Right Arrow move the cursor left and right in the current command line being edited.

 

Useful command line-editing shortcuts

Ctrl+a – Jump to the beginning of the command line.

Ctrl+e – Jump to the end of the command line.

Ctrl+u – Clear from the cursor to the beginning of the command line.

Ctrl+k – Clear from the cursor to the end of the command line.

Ctrl+Left Arrow – Jump to the beginning of the previous word on the command line.

Ctrl+Right Arrow – Jump to the beginning of the next word on the command line.

Ctrl+r – Search the history list of commands for a pattern.

 

 

Add Comment