[Ilugc] Few command line Shortcuts

  • From: sbharathi@xxxxxxxxxxxxx (Bharathi Subramanian)
  • Date: Thu Jan 11 14:45:46 2007

Hi,

Here are few Shortcuts, which you can use in the bash prompt. 

Alt+D - Cuts the command string from the current cursor position to 
        end of the string
Alt+F - Forward navigation of a command (string by string)
Alt+B - Backward navigation of a command (string by string)
Alt+T - Swap two command strings
Alt+C - Capitalizes the command string at the cursor position
Alt+U - Changes all the characters in the command string to upper case
Alt+L - Changes all the characters in the command string to lower case

Ctrl+U - Cut from the cursor position to start of line
Ctrl+K - Cut from cursor position to end of line.
Ctrl+Y - Paste the copied buffer
Ctrl+T - Swap two characters
Ctrl+S - Scroll Lock
Ctrl+Q - Clear/unlock the scroll lock
Ctrl+A - Move to start of the command string.
Ctrl+E - Move to the end of the command string.
Ctrl+B - Moves the cursor by a character backwards.
Ctrl+P - equivalent of uparrow(gives the history of previous command).
Ctrl+O - Executes the previous command executed and it will continue 
         the sequence.
Ctrl+I - Equivalent of Tab.
Ctrl+J & Ctrl+M - Equivalent of Enter.

Ctrl+X $ -> Environment Variables completion
Ctrl+X ! -> Command completion
Ctrl+X @ -> Hostname Completion
Ctrl+X ~ -> Username completion
Ctrl+X / -> Filename Completion

$ ls /home/zulfi/21/log/error.log

Now to view the log file in directory 22/log/error.log,

The pattern to be replaced and the replacement should be placed
between ^[carat] symbol. This will substitute the 21 with 22 and 
run the last command.

$ ^21^22^

To substitute 22 with 23 and run the command.

$ ^22^23^

Most of this shortcuts are provided the readline. Read man readline
for more info.

HTH :)
-- 
Bharathi S

Other related posts:

  • » [Ilugc] Few command line Shortcuts - Bharathi Subramanian