Monday, June 9, 2008

Shortcuts for Working in BASH (Bourne Again SHell)

Left/right cursor key --- Move left/right in text
Ctrl+A --- Move to beginning of lIne
Ctrl+E --- Move to end of line
Ctrl+right arrow --- Move forward one word
Ctrl+left arrow --- Move left one word

Ctrl+U --- Delete everything behind cursor to start of line
Ctrl+K --- Delete from cursor to end of line
Ctrl+W --- Delete from cursor to beginning of word
Alt+D --- Delete from cursor to end of word
Ctrl+T --- Transpose characters on left and right of cursor
Alt+T --- Transpose words on left and right of cursor

Ctrl+L --- Clear screen (everything above current line)
Ctrl+U --- Undo everything since last command
Alt+R --- Undo changes made to the line
Ctrl+Y --- Undo deletion of word or line caused by using Ctrl+K, Ctrl+W, and so on
Alt+L --- Lowercase current word (from the cursor to end of word)

Note: If you find these shortcuts hard to remember and you know vi(m),
you can enable vi mode for editing command line using following command:

$ set -o vi

To enable vi mode from start of Bash, add following lines to your ~/.bashrc
# Start vi Mode for command line editing
set -o vi

1 comment:

Tutu said...

Thatz very helpful for the learner. Thank you for the information.
Great Help!!!!!
With Regards,