The following commands are some of the more common commands used in the UNIX shell. This is by no means a complete list, but is plenty to get you started. For detailed information on any specific command, you can use the man command_name command, or check a UNIX reference.

Many commands take flags, indicated with a dash (-) followed by a letter, or two dashes (--) followed by a word. Commands that require a filename or directory can indicate a file using the relative path (based off the working directory) or the absolute path (based off the root directory of the server). To indicate the absolute path, start the path with a slash (/). When using the relative path, you can move up the directory tree using the special directory ... For example, to move from the /home/myuser/www directory to the /home/myuser/mail directory, you can use either cd /home/myuser/mail or cd ../mail.

Command Description Usage
cd Use cd to change your working directory to a different one
cd directory
pwd The pwd command echoes your working directory.
ls ls lists the content of your working directory. Common flags for the ls command include -l (details), -a (all files, including hidden), and -F (indicate directories with a /)
ls [-alF]
mkdir The mkdir command makes a new directory (folder) inside your working directory. You can also indicate other directories using the / or .. paths
mkdir dirname
rmdir Remove an empty directory. If the indicated directory is not empty, it will not be deleted.
rmdir dirname
cp The cp command copies a file or directory to a new location.
cp oldname newname
mv mv moves a file or directory to a new location. This is different from cp because the old file is removed. For this reason, it is a good idea to use caution when using this command.
mv oldname newname
rm The rm command removes (deletes) a file or directory. When used on a directory, the -R flag recursively deletes all the contents of the directory as well. The -f flag forces unconfirmed delete. Any time you use the rm command requires caution, especially when using it with wildcards or the -R flag.
rm [-Rf] filename
cat cat prints the contents of a file to stout (standard output, in most cases, your screen). You can use cat to view the contents of a text file, or use it in conjunction with other commands such as grep. You can redirect the output of cat using the standard redirect (>).
cat filename
grep The grep command matches an indicated text pattern in the contents of specified file(s). In other words, you can search through a file and find every instance of a given word. grep is frequenly used with wildcards, or on the redirected output of other commands (for example, ls -l > grep *.html)
grep searchstring 
  filename [filename2]
tar The tar command is used to create compressed archives of files or directories. tar produces highly compressed files that are ideal for off-site or tape back-ups. Many compressed archive programs for PC and Mac do not support the tar format, so it may not be ideal for file transfers. The tar command takes the -c flag to create a new archive, -x to extract the contents from an existing archive, and the -v flag allows you to view what is being done. The -f flag must be the final flag, followed by a filename to indicate a specific file.
tar [-cxvf] tarfile
  filename [filename2]
zip The zip command compresses files in a format that is compatible with most PC and Mac software, making it an excellent option for uploading or downloading files from your local computer.
zip zipfile 
  filename [filename2 ...]
unzip unzip uncompresses files created with zip.
unzip zipfile

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771