1) Tab key = to complete a file name. very useful for long file name
ls <enter>
finance-report-june-2008 sales-report-june-2008 engineering-report-june-2008
if i want to open finance report i can just type
more fi<tab>, it will auto complete the filename become more finance-report-june-2008
.
2) Ctrl+R = to search for a keyword in history
.
3) !string and !num = to perform previous action in history
Example for !string
!ssh <enter>
it will perform previous command in history ssh 122.456.789.123 -l mylogin
.
Example for !num
type history to see all the previous commands, you can see for each command is assigned an id
!54 <enter> ( ! followed by the id number)
it will perform the command in history with id number 54
.
4) Tilde (~) = shortcut to home directory
cat ~/.bash_profile
to refer to your own directory
cat ~julie/public_html
to refer to another user’s home directory
.
5) Command editing Tricks
There are many but i find these are the most useful
Ctrl + a = moves to beginning of line
Ctrl + e = moves to end of line
Ctrl + w = deletes the word before the cursor
Ctrl + u = deletes to beginning of line
Ctrl + k = deletes to end of line
Ctrl + y = undo a deletion
Alt + b = moves to beginning of line word by word
Alt + f = moves to end of line word by word
September 27, 2008 at 12:17 am
Nice writing style. I look forward to reading more in the future.