Monday, October 26, 2009

Linux Command Line Navigation Quick Examples, Tips

$ cd -
____switch to previous directory

typing commands:
  • tab : auto-complete
  • ctrl-a : move cursor to beginning of line
  • ctrl-e : move cursor to end of line
  • ctrl-k : delete whole line from cur
  • ctrl-w : delete previous word
  • Esc b : move backwards one word
  • Esc f : move forwards one word
  • ctrl-c : cancel command
$ crtl-r
____search command history for matching commands
$ alias ls='ls -lG'
____make ls an alias for ls -lG. The G adds color in OS X panther+. Have to put in your ~/.bash_profile to retain.
$ history
____view command history, $ !47 to execute that command, !! executes last command
$ pushd
____like cd, but stores the directory in history so you can go back to it with popd, which is like the 'back' button.

$ pushd
____like cd, but stores the directory in history so you can go back to it with popd, which is like the 'back' butt

shortcuts / symlinks / symbolic links in linux:

$ ln -s target link_name
$ ln -s /usr/local/long_directory/ ~/short_cut

after following a sym link, type pwd -P to get the absolute path

and to change to it, type cd `pwd -P` (the backwards apostrophe on the ~ key)

No comments: