Most common UNIX commands

Command Meaning Example
ls directory listing ls -al /bin
ls -lR ~/Desktop
cd change to directory cd
cd Desktop
cd ~/Desktop
cd /etc
pwd show current directory pwd
mkdir/rmdir create/remove directory mkdir scripting
rmdir scripting
chmod change file/directory permissions chmod 755 myscript.sh
chmod 700 mydirectory
chmod 644 myfile
man on-line help man man
man ls
man ascii
cat show a file's contents cat /etc/passwd
more like cat, but page by page more /etc/passwd
cat averylongfile | more
rm remove file rm mytestfile
cp copy file or directory cp mytestfile yourtestfile
cp -r scripts morescripts
mv rename/move file mv mytestfile yourtestfile
mv mytestfile /dev/null
echo write arguments to the standard output echo "Hello"
echo $PATH
which show which executable (if any) will be used    which ls
which mozilla
which which
grep search in files grep -i something *.java
find find files find  .  -name \*test\*
find .
find  .  -name  \*.mp3  -exec play {} \;  
find -mtime 0
head / tail show first/last lines of a file head -20 myfile
tail -20 myfile
tail -f myfile
history and bang    show and use history of commands history
!!
!23
ls !$
tar create or unpack archives tar cvf tarfile.tar *.jpg
tar xvf tarfile.tar
top show list of processes top -o cpu