Faculty for Chemistry and Pharmacy - Group of Prof. Zipse

UNIX commands for computational chemistry

The most important UNIX commands needed in this course are:

changes the directory; when given without any arguments, the shell moves to the users home directory. In order to change to a specific directory, the full pathname must be given e.g. cd /usr/local/bin changes to the directory /usr/local/bin. Moving up one directory can be done more easily by using cd ..

cp file1 file2
copies file1 to file2.

shows all volumes mounted on the system together with the current usage. If used with the -k modifier, the usage information is given in units of 1K. On some systems this is the default, on others the size is given in units of 512-byte blocks. On most systems the -h modifier is also supported giving the sizes of the mounted volumes in "human readable" units such as MB, GB, or TB.

calculates the size of the current directory. If used with the -k modifier, the directory size is given in units of 1K. On some systems this is the default, on others the size is still given in units of 512-byte blocks. On most systems the -h modifier is also supported giving the sizes of the mounted volumes in "human readable" units such as MB, GB, or TB.

find -iname file
finds file file in the current working directory as well as all of ist subdirectories. The command find -iname "*400" will thus locate all files whose names end with the string 400.

grep string1 file2
search for string1 in file file2. The command grep "B3LYP" test*.log will search for string B3LYP in all files starting with test and ending with .log. Please observe that UNIX is case sensitive (e.g. "B3LYP" is different from "b3lyp"). Case sensitivity can be ignored by adding the -i modifier as in grep -i "B3LYP" test*.log. In case the search string occurs repeatedly in one file, all occurences are listed. This can be used efficiently to follow the progress of, for example, geometry optimizations by searching for a string that reappears in the output file for each optimization cycle. The strings "SCF" or "RMS Force" will, for example, be helpful in many optimizations done with Gaussian 09. Searching through all files of a given file system can be achieved with the -r modifier. The command grep -r /scr6/user99 -e "573442" thus searches for number sequence 573442 in all files located in file system /scr6/user99. For searching binary files, use grep -a.

gzip file1
compress file1 using the gzip program. Upon compression a new (compressed) file file1.gz will be generated. Decompression is possible using either gunzip file1.gz or gzip -d file1.gz.

logout or exit
terminate a shell (window).

list all files as well as subdirectories of a directory in alphabetical order using the -l modifier gives a more informative listing, one file per line. The command can be combined with search strings in order to produce partial listings. For example ls test*.com will list all files starting with the string test and ending on .com.

mkdir name
creates directory name as a subdirectory of the current working directory.

more file1
displays the content of file1 page by page. This only makes sense for text files, of course, and also works for output files that are too large to be loaded into an text editor.

mv file1 file2
changes the name of file1 to file2.

shows processes running on the system. Use of the -f or -l modifiers produces a longer listing containing more information. Use of the -e modifier gives information on processes of all users. Unfortunately, the exact format and meaning of the modifiers depends substantially on the particular UNIX version used. On some LINUX platforms ps -ef will give all the required information.

prints the name of the current working directory.

rm file1
removes file file1. This only works if file file1 is owned by the user or if the user has write permission for this file. One helpful variant is rm -i which prompts the user to confirm deletion of a file.

rmdir name
removes directory name. This only works if there are no files left in directory name.

sftp host1
connects to host1 for a file transfer session.

ssh host1
connects to host1 for an interactive session.

tail file1
shows the last few lines of file file1. tail -50 file1 gives the last 50 lines of file1. Output files of calculations that are currently running can most easily be followed by tail -f file1, file1 being the name of the output file.

shows who is logged into the local system.

Several UNIX commands can effectively be combined through the pipe symbol |. The command ps -ef | grep "g09" for example will show you how many processes connected to Gaussian 09 (short: g09) are currently running on your system. In case the results produced by commands such as ps, grep or df become too extensive, it may be practical to redirect the output stream to a text file. The comnmand grep "Done" example01.log > example01done.log, for example, redirects the results produced by command grep "Done" example01.log to file example01done.log.

Information on UNIX commands can also be obtained using the standard UNIX manual pages. In order to get information on, for example, the mkdir command, simply type man mkdir. In some cases using the help function of individual UNIX commands may also help such as mkdir --help.

More detailed information can be found on the official LINUX server www.linux.org.