Unix Commands

Unix commands are intentionally short, often only two or three characters in length, in order to minimize typing.

The general format for a Unix command is:

	cmd -options other arguments

where "cmd" is the name of some command followed by a number of options or other arguments.

Options are generally single characters that represent specific options. The minus sign "-" should be entered before an option. Observe the format of the option in the "man" command in the following table.

Unix is case-sensitive, so be sure you enter the options and arguments in the proper case. Generally lower case is used for commands.

A few commands you should become familiar with:

cd path

change directory.


change to home directory

cp path1 path2

Copy file(s).

chmod permissions path

change the mode, the permissions, on a file or directory.
chmod 755 file sets the file permissions to: rwx r-x r-x
            Owner read, write, execute
            Group read, no write, execute
            World read, no write, execute
chmod 700 file sets the file permissions to: rwx --- ---
            Owner read, write, execute
            Group no read, no write, no execute
            World no read, no write, no execute
(Binary bells should be ringing in your head by now.)


call up the "ftp" (file transfer protocol) program.


to get a listing of files in a directory
ls -l gives a long listing, showing permissions.

man command

to get a Unix Manual entry for a command.
e.g. man passwd

man -k topic

use the -k option to find all the entries for a specific topic.
e.g. man -k password

mkdir path

make a directory

more command

When the command is executed, more pauses the output when the screen is full. You can view the next screenful or just the next line. Look for the instructions at the bottom of the screen. Enter q to exit more.

mv file1 file2

move file1 to file2 or rename file1 to file2. The original file is deleted.


change your Unix password.


call up the "pine" mail utility.


print working directory, i.e. show current path.
In other words: where am I in the Unix file system.

rm path

to delete (remove) a file

rmdir path

to delete (remove) a directory.

script file_name

cause everything that appears on the screen to be placed in the file_name.
Turn this off by entering ^d (control-d).

The following illustration explains how to use several of these Unix commands to create a "Home Page" that can be viewed as an Internet World Wide Web file.


Ensure that you are in your home directory.
(If it does not get any arguments, "cd" assumes your home directory.)

chmod 711 ~/

Change the mode of your home directory to make it world readable.
711 sets permissions: (rwx --x --x)
Owner has "rwx" - read, write, execute permissions;
Group has "--x" - execute permission only;
World has "--x" - execute permission only.
The tilde character "~ indicates your username.
The slash character "/ indicates your home directory.

mkdir public_html

Make a directory called "public_html"; notice the underscore character.

chmod 711 public_html

Make public_html world executable.

cd public_html

Change your location to the public_html directory you just created.


Print the current working directory just to make sure you are where you want to be.


Use an editor to create a file called index.html or copy a sample file from another location.

ls -l

Get a long listing of your current files. If you had used vi to create the file, you will see something like this:
-rw------- 1 user_name your_group 12 Apr 15 10:00 index.html
This means that you, the owner has read and write permission, and that everyone else is excluded.

chmod 644 index.html

Change the file mode so that others can read the file.
644 sets permissions: (rw- r-- r--)
Owner has "rw-" - read and write permissions;
Group has "r--" - read permission only;
World has "r--" - read permission only.

ls -l

Get a long listing to make sure the file permissions are set properly.

Copyright: Department of Computer Science, University of Regina.