際際滷

際際滷Share a Scribd company logo
UNIX Command Cheat Sheet
Physics 91 SI Handout 04
Alex Ji and Zahan Malkani
Command Description Examples and Options
Most Important Command!
man Manual for other commands. man cat
Navigating Directories
ls List the contents of the directory. ls -lart /afs/ir.stanford.edu
cd Change directory. cd WWW/
pwd Print working directory. pwd
Modifying Directories and Files
mkdir Make new directory. mkdir physics91SI
rmdir Remove directory. rmdir physics91SI
mv Move 鍖les. mv -i foo.txt foo2.txt
cp Copy 鍖les. cp -i ../foo.txt .
rm Remove 鍖les. (Cannot undo!) rm -i foo.txt
Viewing Files in Terminal
less View 鍖les easily. less foo.txt
cat Concatenate 鍖les. cat foo1.txt foo2.txt
Important Symbols
* Wild card, any number of charac-
ters.
ls *.txt
? Wild card, 0 or 1 characters. ls foo?.txt
. Current directory. cd .
.. Directory one level up. cd ..
& Run process in background. emacs &
| Pipe/鍖lter output through another
program.
cat foo.txt | less
> Redirect standard output to. cat foo.txt > foo2.txt
< Redirect standard input from. less < foo.txt
Common text editors: emacs, vim, vi, pico, nano
Command Description Examples and Options
File Manipulation (Fill out yourself)
wc
sort
head
tail
split
cut
paste
uniq
pr
Permissions (Fill out yourself)
chmod
Job Manipulation (Fill out yourself)
ps
kill
jobs
fg
bg
Ctrl-z
Ctrl-c
Searching (Fill out yourself)
grep
find
Miscellaneous (Fill out yourself)
touch
who
whoami
du
diff

More Related Content

04 unix commands

  • 1. UNIX Command Cheat Sheet Physics 91 SI Handout 04 Alex Ji and Zahan Malkani Command Description Examples and Options Most Important Command! man Manual for other commands. man cat Navigating Directories ls List the contents of the directory. ls -lart /afs/ir.stanford.edu cd Change directory. cd WWW/ pwd Print working directory. pwd Modifying Directories and Files mkdir Make new directory. mkdir physics91SI rmdir Remove directory. rmdir physics91SI mv Move 鍖les. mv -i foo.txt foo2.txt cp Copy 鍖les. cp -i ../foo.txt . rm Remove 鍖les. (Cannot undo!) rm -i foo.txt Viewing Files in Terminal less View 鍖les easily. less foo.txt cat Concatenate 鍖les. cat foo1.txt foo2.txt Important Symbols * Wild card, any number of charac- ters. ls *.txt ? Wild card, 0 or 1 characters. ls foo?.txt . Current directory. cd . .. Directory one level up. cd .. & Run process in background. emacs & | Pipe/鍖lter output through another program. cat foo.txt | less > Redirect standard output to. cat foo.txt > foo2.txt < Redirect standard input from. less < foo.txt Common text editors: emacs, vim, vi, pico, nano
  • 2. Command Description Examples and Options File Manipulation (Fill out yourself) wc sort head tail split cut paste uniq pr Permissions (Fill out yourself) chmod Job Manipulation (Fill out yourself) ps kill jobs fg bg Ctrl-z Ctrl-c Searching (Fill out yourself) grep find Miscellaneous (Fill out yourself) touch who whoami du diff