UNIX Commands Quick List

UNIX is EASY! There are only ~45 commands that you have to learn to use a UNIX workstation. Before reading this list of unix commands, you may want to review the Abbreviations Used in this Guide.

Environmental Commands

logout or exit end terminal session
passwd change password
date print date & time
whoami or who am i list current user in that window
who list all users logged onto the workstation
man command1 print on-line UNIX manual page for command1
ftp hostname start file transfer protocol to transfer file between local and remote workstations. Remote workstation is named hostname
telnet hostname log onto remote workstation named hostname
df -k print list of disks and current capacity (in kilobytes)
setenv list environmental variables
which command list location of executable command

File Manipulation

ls list contents of current directory. Examples:
ls file.1 lists presence of file.1
ls -l lists presence of file.1 with expanded information
ls -a lists contents of current directory, including files that start with "."
jot file.1 opens jot editor; reads file.1 into jot for editing
cat file.1 show contents of file.1 on screen
more file.1 show contents of file.1 on screen, but doesn't scroll past top of screen
head file.1 show first 20 lines of file.1 on screen
tail file.1 show last 20 lines of file.1 on screen
diff file.1 file.2 shows differences between file.1 and file.2
wc counts lines, words, and characters in file file.1. Variations:
wc -l counts lines in file file.1
wc -w counts words in file file.1
wc -m counts characters in file file.1
cp file.1 file.2 copies file.1 to file.2. If file.2 exists, it is overwritten. Original file.1 is not removed
mv file.1 file.2 moves file.1 to file.2. If file.2 exists, it is overwritten. Original file.1 is removed
rm file.1 remove file.1. No utilities exist to retrieve it
grep PATTERN file.1 print all lines that contain PATTERN in file.1
lpr file.1 print file.1 on default laser printer
lpr Show list of available printers and questions to direct your printing of a file to a particular printer
du -sk print size (in kilobytes) of current directory ("."). Variations:
du -sk * prints sizes (in kilobytes) of all files and sub-directories
du -sk file.1 prints size (in kilobytes) of file.1
compress file.1 reduce the size of file.1 and replace it with a file named file.1.Z. This compressed file is NOT a (readable) ASCII file.
uncompress file.1.Z restore the compressed file file.1.Z
find . -name file.1 -print find the loation of file.1 in the directory and sub-directories. Variations:
find . -name "*pattern" -print finds all files that end with pattern.
find . -name file.1 -exec rm '{}' ';' removes all files named file.1.
grep pattern file.1 print only the lines of file.1 that contain pattern
sort file.1 displays contents of file.1 sorted alphabetically. Variations:
sort -n file.1 displays contents of file.1 sorted numerically
sort -r file.1 displays contents of file.1 sorted alphabetically in reverse order.

Directory Manipulation

pwd show the directory that you are in (present working directory)
cd dir.1 change directory to dir.1
mkdir dir.1 make new directory dir.1
rmdir dir.1 remove EMPTY directory dir.1
rm -r dir.1 remove directory dir.2 AND its contents
cp -r dir.1 dir.2 copy dir.1 (and its contents) to dir.2
mv file.1 dir.1 move file.1 to dir.1
ls show contents of current directory. Variations:
ls dir.1 shows contents of dir.1
ls -d dir.1 shows PRESENCE of dir.1
du -sk dir.1 show sum of size (in kilobytes) of dir.1 and its contents
tar -cvf dir.1.tar dir.1 store an image of dir.1 and it's contents in file file.1

Process Control

command1& execute command1 in background
ps -ef print expanded list of all processes
kill pid1 remove process pid1
<control-c> interrupt current process
<control-z> suspend current process
jobs display background and suspended processes
kill %1 remove suspended process #1
top display the current, most computer-intensive commands
osview display the operating system statitistics

System Security

The following mechanism is the ONLY guaranteed method of protecting your work.

Each file and directory is owned by a user, and each user belongs to a group. By default, users own their home directory (the current directory when the user logs in) and the contents of the home directory. Most other files and directories are owned by "root" and other special users. The user assigns a type of privilege to each file and directory owned by the user. By default, the privilege is rwxr-xr-x.

The first three characters of rwxr-xr-x indicate that the owner can read, write, and execute the file (or directory). The middle three characters indicate that all other users in the same group as the owner can read and execute the file (or directory), but cannot write onto the file (or directory), as indicated by the middle "-" character. The last three characters indicate that everyone else on the system can read and execute the file (or directory), but cannot write onto the file (or directory), as indicated by the last "-" character.

To change the owner's permissions of a file (or directory), the owner can type:

chown u+r file.1   chown u+w file.1   chown u+x file.1
chown u-r file.1   chown u-w file.1   chown u-x file.1
To change the group's permissions of a file (or directory), the owner can type:
chown g+r file.1   chown g+w file.1   chown g+x file.1
chown g-r file.1   chown g-w file.1   chown g-x file.1
To change the permissions of a file (or directory) for everyone else, the owner can type:
chown o+r file.1   chown o+w file.1   chown o+x file.1
chown o-r file.1   chown o-w file.1   chown o-x file.1

Typing Shortcuts

A. file* specifies all files and sub-directories that start with "file" and have 0 or more extra characters. *file* specifies all files and sub-directories that contain the string "file" anywhere in their name. fi*le specifies all files and sub-directories that start with "fi" and end with "le", with 0 or more extra characters.

B. file? specifies all files and sub-directories that start with "file" and have one extra character.

C. The current directory can be specified as ".", and the parent directory of the current directory can be specified as "..". For example, if the current directory is /usr/people/mpagel, I can copy the file /usr/people/huffman/Crambin.pdb to /usr/people/mpagel/pdb/ by typing:

cp  ../huffman/Crambin.pdb  ./pdb/

D. Text on the screen can be highlighted by sweeping the mouse cursor over the text while pressing and holding the left mouse button. This text can be inserted at the command line by clicking the center mouse button, regardless of the mouse cursor position (as long as the mouse cursor remains in the window).

E. If you type the first part of the name of a file or sub-directory in the current directory and then hit the <Esc> escape key, the workstation will complete the name for you. For example, if the current directory contains the files template.001 and temporary.stuff, then I can type:
more templ<Esc>
and the workstation will complete the name template.001. Note that if I type:
more temp<Esc>
then the workstation will NOT complete the file name, since I have not specified enough characters to unambiguously specify template.001 instead of temporary.stuff.

F.  history   shows list of last 100 commands
    !!        repeats last command
    !32       repeats command #32 in the history list
    !mor      repeats last command starting with "mor"

G. If I type mv file.1 dir.1 to move file.1 to dir.1, then I can move file.2 to dir.1 by typing ^1^2, which does the following command: mv file.2 dir.1. Note that the only the first "1" (in file.1) changes, and the "1" in dir.1 does NOT change.

H. Many commands have 'modifiers'. For example, ls -l has a modifier "-l" which specifies that the LONG listing of the directory contents should be printed. Many modifiers can be combined in any order in one command. For example ls -la specifies the LONG listing of ALL directory contents.

I. The "|" character is called the PIPE character. This character is located on the key just above the <Enter> key on the SGI keyboard (you mut also hold down the <shift> key). The pipe character is used to direct the output of one command into the input of a second command. For example,
ps -ef | grep biosym
first creates a list of processes (ps -ef) and then filters this list to show all lines that contain "biosym" (grep biosym).


Abbreviations Used in this Guide

Text that appears on the screen is highlighted in bold. Text for which the user substitutes the name of a file, directory, command, etc., appears in italics.
<control-x>          type 'Ctrl' and 'x' keys at the same time
file.1, file.2       files named file.1 and file.2
dir.1, dir.2         directories named dir.1 and dir.2
command1, command2   commands named command1 and command2
pid1                 process ID, listed by typing ps -ef

Files, directories, and commands can be specified without ambiguity by using the full pathname, such as /usr/people/huffman/pdb/Crambin.pdb. If the file, subdirectory, or command exists in the current directory, it can be specified using ONLY it's name. For example, if the current directory is /usr/people/huffman/pdb/, then I can type Crambin.pdb to specify this file. Some special files and directories, and almost all commands, can also be specified using ONLY it's name regardless of your current directory, because they exist in special directories of the system.


Back to  |  Application Guide  |  MolViz Home  |
Send comments to chemvis@indiana.edu
Last updated: 01/23/2001