Unix Cheat Sheet
May 20, 2005
SPECIFYING the PATH:
.. . ˜ directory one level up. current directory. home directory.
NAVIGATION:
ls list. cd change directory. pwd present working directory.
Wildcards anything. ? any one character. [ ] anything in the box. [ˆ ] anything not in the box.
FILES:
cp copy, mv move, and rm remove file. CAUTION! View cat concatenates given files, dumping output to terminal. head, tail Show begining/end of file. less, more Scrollable file viewers. Search locate [string] find all files with [string] in their name. grep [pattern] [file(s)] find all occurances of [pattern] in [file(s)]. which [cmd] Show path to command.
EXITING:
Try one of q, quit, quit(), Ctr-D, or Ctr-C. When desperate, use xkill or kill (ps will give you the process id). When truely desperate, log out. When all hope is gone, your initiation is complete.
GETTING HELP:
Try, in this order: 1. typing the command by itself. 2. [command] -h or -u. 3. man, info [command]. 4. Ask your neighbor. 5. Google.
EMACS KEYCHORDS:
Moving C-v Forward screen. M-v Backward screen. C-l (Control-ell) Point-to-top. C-f C-b M-f M-b C-p C-n C-a C-e M-a M-e Forward character. Backward character. Forward word. Backward word. Previous line (up). Next line (down). Beginning of line. End of line. Beginning of sentence. End of sentence.
Kill/Delete Delbk delete character before cursor. Delete delete character after cursor. C-d delete character after cursor. M-Delbk kill word before cursor. M-d kill word after cursor. C-k M-k C-y M-y kill to end of line. kill to the end of sentence. yank text back. yank previous text.
Files/Buffers C-x C-f Find file. C-x C-s Save file. Other C-g M-x Cancel current command. Enter command name.