Command Description* Example command(s)**
apropos Locate commands by a keyword apropos delete
cd Change directory
“cd [directory_name]” change to
named directory within
current directory
“cd” change to your home directory
“cd ..” change to directory above
cd Data
cp Copy a file (see also “scp”)
option “-p” keeps same date and time
cp -p file2.dat lowerdirectory/
find Find a file in the current directory and those below it find . -name “filename.ext” -print
grep Search for text within the designated files grep “look for this string” *
kill PID Terminate a process, must give process identification number (PID). kill 12068
man Manual (help) on a particular command, shows options available man apropos
more Print a text file to the screen more file2.dat
mv Rename (move) a file mv file2.dat file3.dat
ls List file directory
“-a”  lists all files, including
those that begin with “.”
(i.e. “hidden” files)
“-l”  lists in long format
“-la” lists all files in long format
“-s” lists files and their sizes
ls filename
ls -a filename
ls -la filename
lp Print a file lp file3.dat
mkdir Make (create) a subdirectory mkdir directory2
ps Report process status ps
pwd Print working (current) directory pwd
rm Remove (delete) a file rm file3.dat
rmdir Remove (delete) a directory rm directory2
scp Secure copy (between two computers).  You will be prompted to give your password to the other machine.  You can copy from or to another computer (machine2).  Username (and “@”) is not necessary if it is the same as the username on the first (current) machine. To machine2:  scp -p file4.dat username@machine2:Directory_Path/
From machine2:  scp -p username@machine2:Directory_Path/file4.dat./
tail Prints out the last portion (one screen) of a file tail file3.dat
top See a table of continuously updated data on currently running processes “top” enter “q” to exit
wc Word count:   counts words (-w), lines (-l), characters (-m), or bytes (-c). wc -l filename
whatis Tells what a command is whatis mkdir
who Who is on the system who
whoami Who you are (on the system) “whoami” or “who am i”
which Locates program executable files defined by an alias, need to give alias name which mkdir

*Options are listed after the initial command with a preceeding space and hyphen (e.g. wc -w filename).  One letter options may be listed separately (each with a preceeding space and hyphen, e.g. ls -l -a filename) or together after a single space and hyphen (e.g. ls -la filename).  The option must be designated after the command but before the file(s) “receiving” the action.
**Where “filename” is given here, directory names, wild card (“*”), or multiple filenames may be used where appropriate.  A file not in the current directory should be preceeded by the path name, which can be relative to the current directory (e.g. ../directory/filename) or full path (e.g. /home/username/directory1/directory2/filename).

Other Help

File-Access Permissions

If you execute the command “ls -l” or “ls -la”, the first column is a block of 10 characters that shows permissions for the file or directory listed.  For example,

The first character indicates if the entry is a directory (d), link (l), or normal file (-).
The next nine characters show permissions to read (r), write (w), and execute (x) the file or directory. A “-” indicates no permission for one of those three actions. Characters 2-4 show the user’s permissions, 5-7 the group’s permissions, and 8-10 the other user’s (the world’s) permissions. To change the permissions use the command “chmod”. Usually directories are drwxr-xr-x. Files are usually -rwxr-xr-x if the file is an executable file or a script and -rw-r–r– if a non-executable file (e.g. data or text). A few sample commands are listed below (the command affects the file or directory named).

Commands that give the most common file permissions:

  • chmod 644 name Allow user to read and write. Allow group and others to read.
  • chmod 755 name Allow user to read, write, and execute. Allow group and others to read and execute.
  • chmod +x name Give user, group, and others permission to execute as well as previous permissions.

Commands for less common file permissions:

  • chmod 777 name Allow user, group, and other users to read, write, and execute.
  • chmod 0400 name Allow only the user to read.
  • chmod 0600 name Allow only the user to read and write.
  • chmod 0700 name Allow only the user to read, write, and execute.
  • chmod 0007 name Allow only other users (the world) to read, write, and execute.
  • chmod o=r name Give other users (the world) permission to read.
  • chmod o+x name Also give other users (the world) permission to execute.
  • chmod o-x name Take execution privileges away from other users (the world).
  • chmod u=rwx name Give user permission to read, write, and execute.
  • chmod g-rwx name Take away group’s permissions to read, write, and execute.

Enter “man chmod” for more detailed information.

Stop a Running Program

  • Crtl-C, kills a running process in the current window (may not work within programs that have their own interface within a terminal or shell window, e.g. text editors).
  • Use kill as described in table above from another shell (or terminal).


  • “./” Current directory–to run a program or script that is in the current directory enter “./name”.
  • “../” Directory above–you may use multiple “../”s to reach directories far above the current one (e.g. “../../../”).  To reach a directory at the same level as your current directory–without leaving the current directory, use “../name2″.
  • “>” –place screen output in a text file, e.g. “wc -l filename > file2.txt” will count the number of lines in filename and write that information in file2.txt.
  • “<” –use information in subsequent file as input, e.g. program options < input.txt.  This is useful for programs that require user input to be entered as the program runs.
  • “|” “Pipe” output from one program into another–the data becomes input to the second program.  For example, the following command counts the number of files in the current directory:  “ls * | wc -w”.  In this case, a file name is not needed after “-w” because the output from “ls *” is the input.

Tar Files (For Archiving or Transferring)

  • tar -zcvf ../mytarfile.tar ./* takes all files in the current directory and writes a compressed (gzip) tar file in directory above
  • tar -cvf ../mytarfile.tar ./* takes all files in the current directory and writes a tar file in directory above
  • tar -zxvf mytarfile.tar unpacks (gunzip) a compressed tar file in the current directory
  • tar -xvf mytarfile.tar unpacks a tar file in the current directory

Text Editors

vi is a standard UNIX editor.  The following are other text editors that may or may not be available on your machine:  emacs, jot, nedit, pico, and xedit.  These may open a new window and allow you to use a mouse, or they may operate within your current shell or terminal window.

See also and

Within a Program that Runs in a Shell or Terminal Window

  • “h” generally gives help
  • “q” generally exits

Compiled by D. Belnap, 14 May 2010, please email suggestions or corrections to David {dot} Belnap {at} utah {dot} edu.
Disclaimer:  This webpage is meant to show commonly used UNIX commands.  It is not meant to be a comprehensive list..