Useful UNIX Commands
Here are a few useful UNIX commands to allow you to manipulate your files. Note that these UNIX commands are similar to DOS commands. In the description below, change the item in italics to the actual item you are interested in.
UNIX command | Description |
ls | lists files in the current directory (directory = folder) |
ls stuff* | lists all files that start with "stuff" and have any ending (* is a "wildcard") |
ls -l | lists files in long format |
cd directory | change the current directory to directory |
cd .. | goes to the directory one level up. (two periods, .. signifies the directory one level up.) |
cd | returns you to your home directory |
cp filename(s) directory |
copies a file (or files) into a directory |
cp filename . | copy a file into the current directory (a period, . , signifies the current directory) |
history | lists previous commands typed in and their number |
more filename | lists the contents of filename. Use the space bar to advance; type /string to search for string; type q to quit. |
mv filename newfilename | rename (move) a file |
mv filename directory | move a file into a directory |
mkdir directory | make a new directory |
pwd | list the current directory (or "print working directory") |
rm filename | delete (remove) a file |
rm -R directory | removes a directory and all of its contents |
rmdir directory | removes an empty directory |
!! | redo last command |
!# | redo command number # (replace # with an actual number. Example: !4 retypes in command #4. Note: history tells you which number to use for each command previously typed.) |
command & | runs the command command in the background. Example: icharmm & runs the command icharmm in the background. |
Additional Notes:
cp *.gif images
would copy all files with the extension ".gif" to the subdirectory "images".
If you run a job from the command line, and then realize you want to run it in the background, type control-z, which halts the jog, and then type bg to start it up again, but in the background. The advantage of running jobs in the background is that when you log out, the job continues to run.