Unix Command Summary
Part One: Basic Commands

IMPORTANT: Upper and lower case letters are significant to the Unix system. Your login id, password, and all commands must be entered in the correct case or they will not work. LS is not ls, for example.

The basic prompt is the machine's name, and a %; your prompt may be longer and contain your account name. When the prompt has appeared on the screen, you may enter commands. Each command is the command word plus any options. Command options often begin with a - sign (e.g. ls -l, ps -ax). Each command line must be terminated with a <RETURN>.

Logging on

login: user_name
password: password

Logging off

% exit or (You will not be allowed to logout the first time, if you have stopped jobs. You can either kill these jobs or logout again.)
% CTRL-D

Changing your password


% passwd
Old password: oldpassword
New password: newpassword (new password - 6 characters minimum)
Verification: newpassword

Getting on-line help


% man command Show manual page(s) explaining command
% man man Information about using man
% apropos command Show which manual pages refer to command

Seeing what files you have (directory listing)


% ls To see file names in current directory.
% ls -l To see all file information.
% ls *.c To see all file names ending in ".c".
% ls -a To see file names including those beginning with ".".

Managing your jobs


% jobs List the jobs you have running.
% kill %7 End job 7. (Find job number with jobs.)
% kill -9 %7 is slightly more deadly.
% CTRL-C Stop the job that is already running.
% bg %53 Resume job 53, which was suspended, in the background.
% fg %53 Resume job 53 in the foreground
% command & Start a program or command running in the background.

Making a new directory


% mkdir newdir Make new subdirectory of the current working directory.

Changing to a different directory


% cd otherdir Go to a different directory.
% cd otherdir/subdir Go to a different directory and subdirectory.
% cd .. Go to directory above this one.
% cd ~/subdir Go to subdirectory of home directory.

Removing a subdirectory


% rmdir subdir The directory can't be removed unless it is empty.

Deleting a file


% rm byefile Remove the link to the file under this name; when all links are removed, the file is physically removed. CAUTION: rm * removes all files in the current directory. So may rm * .c. Once deleted, the files are GONE. If not aliased by default, you can use rm -i instead, or put the line alias rm 'rm -i' in your .cshrc file.


Index
Next Page