Bash Shortcuts

From Spry Wiki

Jump to: navigation, search

In the BASH shell there are control shortcuts that are based from escape and command sequences. The command and escape sequences were added to terminals to all for changing the display size, color, cursor location. There are many different sets of commands that were defined. The commands in BASH have some of the same effects. One reason to use them is on slow connections, or heavily loaded systems where having the screen updated for each character added or deleted becomes mind numbing.

The shortcuts listed here are based on GNU bash version 3.00. The abbreviation of "CTRL-a" means to press and hold down the Control key and press ' a ' once. The shortcuts *should* be the same for most other shells.

The basic moving shortcuts allow movement to the end of the line, to the start of the line or to step through by character. The commands come in really handy when editing different file in another directory or copying files.


CTRL-a - Moves the cursor the start of the line
CTRL-e - Moves the cursor to the end of the line

CTRL-f - Moves the cursor 1 character forward
CTRL-b - Moves the cursor 1 character backward

The Basic editing shortcuts allow for cutting part of the command line, pasting the cut back into the line, cutting a word or deleting a character.


CTRL-k - Cuts the text under the cursor and to the end of the line.
CTRL-u - Cuts the text behind the cursor to the beginning of the line.
CTRL-w - Cuts the word behind the cursor.
CTRL-y - Pastes the word or text that was cut after the cursor.
CTRL-d - Deletes the character under the cursor. 

(note: When the cursor is at the beginning of the line CTRL-d will log your session off.)


The rest of the short cuts perform more system based changes for your login session. CTRL-c useful for stopping mistakes and CTRL-z is a way of getting back to the command prompt without closing the current running program.


CTRL-l - Clears the screen and places the command prompt at the top of the page.
CTRL-r - Starts a search against the command history. Start by typing in what you want to search by then press CTRL-r to see the matches.
CTRL-c - Kills the current running foreground program.
CTRL-z - Stop/sleep the current running foreground program.
CTRL-s - Stops the output to the screen.
CTRL-q - Allows output to the screen.

Recent Changes | RSS Feed RSS