Common UNIX Commands

General Syntax:$ <command name> <options> <argument1> <arg2> <arg3> ...
Cmd / Syntax / Examples / Description
pwd / pwd / $ pwd / Print the current working directory
ls / ls <directory> / $ ls
$ ls –a
$ ls -la / List contents of a directory
cd / cd / $ cd ./private/files / Change current working directory
man / man <command name> / $ man ls
$ man pwd
$ man man / Get manual page for command
cp / cp <src path> <destination path> / $ cp file1.txt public/cs449/ / Copy a File
mv / mv <src path> <destination path> / $ mv file2.txt textfile.txt
$ mv file1.txt ../../public/html/hello.html / Move or Rename a file
rm / rm <path> / $ rm public/html/hello.html
$ rm temp.txt / Delete a file
mkdir / mkdir <path to create> / $ mkdir cs449
$ mkdir /afs/pitt.edu/home/x/x/pittusr/cs449 / Create a directory
rmdir / rmdir <path> / $ rmdir /afs/pitt.edu/home/x/x/pittusr/cs449 / Remove a directory
echo / echo <src path> / $ echo "A line of text"
$ echo Another line of text / Print text to the terminal
who / who / $ who
$ whoami / Display other users currently logged into the system
finger / finger <search criteria> / $ finger <your_pitt_user>
$ finger Smith / Search user information
cat / cat <path1> <path2> ... / $ cat file1.txt file2.txt file3.txt
$ cat -
$ cat file3.txt > file4.txt / Concatenate files
less / less <path> / $ less file1.txt
$ cat file1.txt | less / Display a file (or any output) one screen at a time with scrolling
more / more <path> / $ more file2.txt
$ cat file2.txt | more / Display a file (or any output) one screen at a time
find / find <path> <option1> <arg1> <opt2> <arg2> ... / $ find ~/public -name "*.txt" / Search for files
grep / grep <search criteria> <path or files> / $ grep "<html>" ~/public/html / Search contents of files
chmod / chmod <new permissions> <path> / $ chmod u+x file.txt
$ chmod 777 file.txt
$ chmod a-w ../public/file.txt
Default is a: all
Numeric values: octal, rwx = 111 in binary, but 7 in octal:
$ chmod 777 cmdfile / Change file permissions (Unix only)
fs / fs <subcommand> <args> /
  • listacl (la): list access control list
  • listquota (lq): list volume quota
  • quota: show volume quota usage
  • setacl: set access control list
    fs setacl directory user rights
    rigths can be: rlidwka[1]
$ fs lq
$ fs la
$ fs setacl . brown rl
$ fs help / AFS utility (file permissions on AFS)
lpr / lpr <path> / $ lpr file.txt / Send afile to a printer
zip / zip <destination path> <file1> <file2> ... / $ zip files.zip file1.txt file2.txt file3.txt / Create a ZIP archive
unzip / unzip <path> / $ unzip files.zip / Extract files from a ZIP archive
tar / tar <option> <destination file> <file1>… / tar cf g.tar A B C
tar xf g.tar / To put a group of files into one single package file.
telnet / telnet <address> / $ telnet unixs.cis.pitt.edu / connect to a remote system
ssh / ssh <address> / $ ssh unixs.cis.pitt.edu
$ ssh <pittusr>@unixs.cis.pitt.edu / connect to a remote system (securely)
ftp / ftp <address> / $ ftp unixs.cis.pitt.edu / file transfer utility
env / env / $ env / Display shell environment variables

[1]rlidwka = read, lookup, insert, delete, write, lock, administer