Quantcast
Channel: When Brains Fly » Uncategorized
Viewing all articles
Browse latest Browse all 10

Some UNIX/Linux Command Line Shortcuts

$
0
0

I have to look this up so many times that I figured I should just blog about it and have it in one easy-to-find place. =)

Text/cursor control:

Alt-B / Alt-F Move the cursor backward/forward one word
Ctrl-W / Alt-D Delete one word to the left/right
Ctrl-A / Ctrl-E Move the cursor to the beginning/end of the line
Ctrl-U / Ctrl-K Erase line to the left/right

History control:

!! Repeat last command run
!-5 Re-run the 5th to last line in the history (!-1 is equivalent to !!)
!str Re-run the last run command that began with str
!str:n The nth argument for the last run command that began with str
!$ The last argument for last run command

(There are many more history control commands, but I don’t need to use them as frequently. See the last two references for them.)

Other useful shortcuts:

Ctrl-S / Ctrl-Q Turn off/on output to the screen (useful if you accidentally press Ctrl-S like I do all the time, or if you have a lot of output streaming to your screen)
Alt-F2 (GNOME/KDE) Display the Run Application dialog

Also, I learned something new today while fixing up the CSS for the site. Margins can overlap. =O

References:
http://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts#Command_line_shortcuts
http://www.computerhope.com/ushort.htm
http://blog.macromates.com/2008/working-with-history-in-bash/
http://www.gnu.org/software/bash/manual/bashref.html#History-Interaction


Viewing all articles
Browse latest Browse all 10

Trending Articles