University of Calgary
UofC Navigation

Stay Connected

I Need Help With...

Contact

Technical Support

Help Desk Location:
Math Sciences 151
University of Calgary
View Map

Help Desk Hours:
Monday - Friday
8:30am - 12:00pm
1:00pm - 4:30pm

T. 403.220.6613
E. scihelp@ucalgary.ca

Submit a Support Ticket: help.science.ucalgary.ca

Common Unix Commands

This is an overview of the most important UNIX commands. Keep in mind that this is only a "starter kit" to get you introduced to UNIX.

Each command has to be completed by the RETURN key.

The boldtype names are the actual UNIX commands, all italics prints are either names or numbers that have to be entered appropriately.

General commands

date    Outputs date and time.
man name Displays a description of the command name and its options.
(Hit the spacebar for line-by-line output. Stop the output with "q".)
whoami Returns the user name.
who Gives a list of all users logged into your machine.
wc name (wordcount) Counts the lines, words, and characters in filename.
passwd Allows you to change your secret password.
exit Exit the current shell.

File commands

ls   Lists all filenames in the working directory, which do not begin with a ".".
ls -a Lists all filenames in the working directory.
ls -l Lists all filenames in the working directory, with more information about the files, such as size, creation date, filetype, etc.
ls name Lists all files in directory name.
cat name Outputs the contents of the file name.
less name Outputs the contents of the file name in a page-by-page fashion.
mv old new (move) Change the filename from old to new.
rm name (remove) The file name is deleted.
cp name name2 (copy) Create a copy of file name. The copied file has the name name2.

Catalog / directory commands

pwd   (print working directory) Outputs the name of the working directory.
mkdir name (make directory) Create a new subdirectory with name name.
rmdir name (remove directory) The subdirectory name is removed if it does not contain any files.
cd name (change directory) The directory name becomes the new working directory.
cd .. The parent directory of the current working directory becomes the new working directory.

Job commands

jobs    Issues a list of all jobs running for the user.each job has a unique number (displayed in square brackets).
fg %n Job number n becomes a foreground job.
bg %n Continue job number n as a background job.
stop %n Stop the job with number n.
kill %n Terminate the job with number n immediately.

Process commands

ps    (process status) Lists all user processes.
kill n Process number n is stopped in a controlled fashion.
kill -9 n process number n is stopped immediately.

Important special characters and control sequences

Control-c    The current program/command is stopped.
Control-z The current program/command is sent to the background and suspended.
Control-d End of file (EOF)
Control-s Stops output on the screen.
Control-q Continues output on the screen.
name & Execute the command name in the background.