Useful Commands

alias name command
Assign "command" to alias "name". If "command" is omitted, the alias name is shown along with its current definition.
bg [%n]
Run the current (or specified) job in the background.
cc file.c
C language compiler. Translates C input files ('file.c') into a machine executable program ("a.out").
cd [dir]
Change your working directory to 'dir'. If 'dir' is omitted, change to your home directory.
cp oldfile newfile
Make a copy of 'oldfile' and call it 'newfile'.
exit
Quit the current shell.
f77 file.f
Fortran language compiler. Translates Fortran input files ('file.f') into a machine executable program ("a.out").
fg [%n]
Bring current job or specified job (%n) into the foreground.
fgrep string filename
Search for pattern "string" in file 'filename'.
history [n]
Display the history list. If n is given, display only the n most recent items.
jobs
List the jobs under job control.
kill n
Terminate process n, where n is determined with the "ps" command. If the job is running in the background, you can use the "jobs" command to find out the job number. In this situation the command would take the form: "kill %n".
logout
Terminate your login shell. Runs the commands in the file '.logout'.
lpr filename
Sends file 'filename' to the lineprinter on the third floor of the CS building.
ls
List the files in your current directory. "ls -l" will list the files in "long" format showing size, modification date, permissions, etc.
man command name
Gives information about the specified command name. You can get more information about all the commands discussed in this section with the "man" command. Typing: "man -k keyword" will give you a short, one-line summary of all the commands dealing with that topic. If you wish to test this, try "man -k information".
mkdir dirname
Creates a directory with name 'dirname'. The "rmdir" command is for removing empty directories.
more filename
Displays the file 'filename' on your terminal screen one screenful at a time. Press [RETURN] to see one more line and press [SPACE BAR] to see one more screen at a time.
mv oldname newname
Changes the name of file 'oldname' to be 'newname'. You can also move a file into another directory with: "mv file newdir". This moves file 'file' into the directory 'newdir'.
printenv
Displays all the current environment variables and their values.
ps
Shows information about processes which are running under your terminal. Use "ps x" to find out about all your processes. This command is useful if you need to find out the process ID of a process in order to "kill" it.
pwd
Prints your current directory.
rm filename
Deletes the file called 'filename'. You might not be asked for confirmation, so be sure you want to remove the file before you type the command. To require confirmation, "rm -i filenames" will ask you to type "y" or "n" before deleting a file.
setenv [VAR [word]]
When used alone (i.e. with no arguments) "setenv" will display all your environment variables and their values. With the VAR argument, the variable VAR will be given an empty (null) value. With both VAR and "word", VAR will be given value "word". [Environment variables are normally given upper case names.]
who
See who is using the system. Try the "w" command for more info.

Click here to go to the top of the chapter.