University Systems --> TerpConnect --> General TerpConnect Information --> Basic Unix Commands -->

Basic Unix Commands

This section assumes that you are new to UNIX, and will go over some of the basic commands that are necessary to get started in a UNIX environment. It is important that you are able to navigate the UNIX file system, which is heirarchical and organized into directories. To the user, it looks similar to the DOS file system that most people are more familiar with, even though it is very different internally. Some basic commands are:

cd [directory]
changes directory

mkdir [directory]
makes a directory

rmdir [directory]
removes an empty directory

pwd
prints the path of the directory you are in

ls
lists the files in your current directory

mv [file1] [file2]
moves (or renames) file1 to file2; file1 and file2 can be absolute paths or simply filenames

cp [file1] [file2]
copies file1 to file2; works in the same manner as mv

cat [file]
displays the contents of a file

more [file]
displays the contents of a file one page at a time. Press the space bar to proceed one page, or the enter key to move one line ahead. You can also do text searches in more by typing '/' and the search string. See the man pages, or type 'h' at the more prompt for details.

When referencing a file or directory, you can use either an absolute or a relative path. An absolute path starts from the root directory (the base of the file system) and begins with '/', and a relative path specifies directories or files starting from the directory that you are currently in. For example, /usr/local/doc/file is an absolute path. If you were already in the directory /usr/local, then you could specify the same file as doc/file. Similarly, from /usr/local, you could cd to either /usr/local/doc or just doc and get the same results.

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site