pwd tells you where you are in the
directory tree
ls lists the contents of the
directory you are in
cd directory_path moves you to
another directory
mkdir directory_name makes a new
directory
rm filename removes a file
rmdir directoryname removes a directory
In order to remove all old files and directories contained in
and below a directory use -r in the remove
statement so it removes recursively. (Use rm not rmdir.)
rm -r directory
Adding the option -f (with or
without the r) avoids having to confirm
each remove (very useful on the supercomputers).
cp filename placetocopyto copies a
file to another location (or name if not a path)
mv filename placetomoveto moves a
file to another location (or name if not a path)
../ means go up one directory (You
can do lots of these in a row (i.e. "../../../")
. stands for the directory you are in
~ stands for your home
directory
Ctrl-a moves cursor to beginning
of line
Ctrl-e moves cursor to the end of
line
Tab will complete typing the rest
of any unique partially typed filename or path.
Many commands have extra options you can add. For instance, using the
ls command above with the extra options:
ls -latr
will list the contents of the directory in reverse
order (oprion r) of the time last modified (option t) with additional
informatiom about the file sizes and permissions.
To copy files between computers use scp
(ftp is no longer allowed for
security reasons), which is almost the same as cp
except that you need to include the user and machine name as well:
scp filename
mayaan@sp.msi.umn.edu:/misc/folder/foo
Where filename is what you are copying and the rest is where you are
copying to. The scp program must exist on both machines for
this to work. If you need to install it on your Windows machine at home,
WinSCP can be found on the web for free at
http://winscp.sourceforge.net/eng/download.php.
If you want to copy something to our group's laptop, you have to scp
from rather than to it:
scp mayaan@sp.msi.umn.edu:/misc/folder/foo
.
which will copy a file called foo in /misc/folder directory of your
machine into whatever directory you are in on the laptop.
If you need to login to your computer from home, or you want to login to
another machine
from your own, you will have to use ssh. On our lab's machines this
will already be installed. To install it on your windows machine
at home go to:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
and get the PuTTY executable you need. For more information you can
read about ssh at the MSI
web page:
http://www.msi.umn.edu/user_support/ssh/
To use ssh:
ssh -l mayaan sp.msi.umn.edu
Where 'mayaan' is your user name and sp.msi.umn.edu is the name of the
machine you are ssh-ing to. (You can also use an IP address instead.)
You only need to add your user name if it is different on the machine you
are logging on to. Otherwise just use:
ssh sp.msi.umn.edu
If you want to be able to use molden or open emacs buffers in a new
window then you will also need to use the options:
ssh -X -Y sp.msi.umn.edu
to enable X11 forwarding. (Usually you will want to do this.)
When you ssh to a particular machine for the first time, it will ask
you if you want to add them to your list of known hosts. Later, if
the name of a machine you have ssh-ed to or from in the past is
changed, it will create conflicts with
the ssh security keys your machine has saved.
If you get this warning, go into the .ssh/known_hosts file within your home
directory and delete the old offending key. It will look something like
this:
pinot-noir 1024 35
1291129784473943918414976868999086549
86410415517156181529778994379806391528830362867173995734
66658080759778377074425427610673221589448680346317493289
5288707144936026451479604363236711070229633796081649813
Most of the files you create in LINUX will be made with a file editor
such as emacs, xemacs or vi. Usually emacs and vi will already be
installed on your machine. To open a new file with emacs type:
emacs filename
If you want to keep using the command line in your terminal while the
editor is open you can type:
Ctrl-z
bg
which places your currently opened file in the 'background'.
Or open the editor instead with:
emacs filename &
If you want to bring the editor into the foreground again type:
fg
As long as the editor (or any program for that matter) is in the
foreground, you can close it by typing:
Ctrl-c
(This isn't the best way to close most programs. It usually comes in
most handy when you accidentally open something and want to quit out
of it immediately.)
To learn about more editor commands you can visit either http://www.cs.fsu.edu/general/vimanual.html for vi or http://www.ma.iup.edu/MathDept/HomePageHelp/emacs.html for emacs. (There are also some additional commands in the miscellaneous section below.)
You can also look at a file using your terminal by typing:
more filename
You can't edit it this way though, only view.
Whenever you want to learn more about how a specific command works,
you can type:
man command or command --help
and a help page will pull up that explains the command details to you.
To print out what man says type:
man -t command >print.ps
and then use the program gv to look at the print.ps file you
created.
gv print.ps
Some common programs we use in the lab that you may want to
familiarize yourself with are:
molden (for viewing Gaussian .out
files or creating .xyz or z-matrix files)
vmd (for viewing CHARMM pdb and
dcd files)
xmgrace or tecplot (for making data graphs)
cvs (for storing and accessing files)
latex or pdflatex (for creating/compiling
LaTeX documents)
gnumeric (for creating spreadsheets)
xpdf or acroread (for viewing pdf files)
gimp (for editing image files)
tkYorkLib.pl (for looking up
journal references)
ooffice (stands for OpenOffice and
is a complete set of word processing, spread sheet, and presentation
software similar to what you may be used to from Windows)
Additional information about using and obtaining most of these
programs can be found on
the Software link of our York Group Intranet.
To search through the files of a directory for a word or phrase use:
grep -i 'word' *
Without the -i option, the grep command will be case sensitive. Other
grep options include:
-v to print lines that do not match
-n to print output with line numbers
-c to print only a count of number of lines matching
To search within all the files of a directory branch for a
word or phrase type:
find . -type f -print -exec grep -i 'searchword' {}
\;
You can also use:
grep -i 'searchword' */*.src90 | grep
INE
where "*/*" will search both the current and next lower directories, and
"| grep INE" will filter out all the lines found with 'searchword'
which don't also contain "INE".
To find any file that has been on your computer for more then a day
type:
locate filename
In addition to editors like emacs, you can also edit files directly
from the terminal using sed, the
built-in stream editor. You can use it to make
substitutions or deletions in a file with commands
such as:
sed 's/oldword/newword/g'
filename
which substitutes "newword" for "oldword". The "g" makes the
substitution global (all instances on that line). Without the g, it
will only change the first match on that line.
Other sed commands:
sed 's/word/d' filename
This deletes the whole line, not just the word. To delete just the
word:
sed 's/word//' filename
The examples given will print out the changes to the terminal. If
you want to print the changes to a file instead type:
sed 's/oldword/newword/' filename >
newfilename where > directs the output into a file called
newfilename
To link more than one command together use &&. For example:
sed 's/oldword/newword/' filename >
newfilename && emacs newfilename
If you want to look at the contents of a tar file before you untar it use:
tar -t filename.tar
If you then decide there is only a small part of the total tar file
you actually need to extract, type:
tar -zxvf tarfile filepath
If you have a large number of files you wish to transfer
you can make it simpler by tarring them first:
tar -cvf file.tar
directory_to_tar
(Make sure you don't reverse the order of "file.tar" and "directory_to_tar").
Then to zip it type:
gzip -cv file.tar
Or better yet, do it all at once with:
tar -zcvf
On our SGIs, this must be done with the command:
tar -tvf file.tar directoryname
instead.
Here's a neat trick for transferring a tar file to another machine
that will tar "on the fly" rather then requiring you to create a tar
file on your own machine first. (Which can be useful if you don't
have much space left.)
To do this simultaneous tar, zip, and transfer type:
tar --rsh-command=`which shh` -zcvf --
--host_computer:filename.tar --
--directory_to_tar
Note that "which ssh" needs back-ticks rather than apostrophies.
After you uncompress a program tar file you will usually still have to
install the
program yourself. The usual directory to install programs in is
/usr/local/. (You
will need root permissions.) Look for a README file in the file's source
code to get further instructions.
An easier method of installing programs though is to get a rpm
package rather then a tar file for a program whenever possible.
Rpm packages do all the work of untarring and installing for you.
A good source for these files can be found at:
http://linux.s390.org/download/rpm2html/index.html
or
ftp://ftp.software.umn.edu/pub/linux/redhat/redhat-9-en/os/i386/RedHat/RPMS
(Note that this particular link is for people using Redhat 9 but if you
go up a few directories you can get to the directory specific to the
LINUX version your using).
To install rpm packages type:
rpm -Uvh file.rpm
You will often have to be root when you do this but you can do it from any
location in the directory tree.
There are lots of other options for rpm files as well. Go to:
rpm --help
to learn more options.
An even easier way to install things is to use
a program that grabs
and installs all the rpms you need for you. One such program (which
you may already have installed) is
called yum and you can get it from:
http://linux.duke.edu/projects/yum/download.ptml.
Once yum is installed you can install new packages by either:
yum install packagename
for a specific package or
yum upgrade
to get everything newly available for your LINUX version.
To see where the executable for a program you want to run is type:
which executablename
To display all of the environment variables which are currently set:
env
To set environment variables needed to run programs such as CVS, go to
the file .bash_profile, (or in c shell to .cshrc). Then, to set up a
variable such as CVSROOT, type:
export
CVSROOT=:ext:theory.chem.umn.edu:/usr/local/cvsroot
which tells CVS to look for its home on theory in the directory
/usr/local/cvsroot. You will have to re-login for these changes to
take effect.
If a variable should be in the path of the whole computer rather than
just a particular user, (such as for a program all users will use), put
this variable in /etc/profile instead.
If you want to be able to run a program from anywhere in your directory tree it needs to be "in your path", meaning in the list of places it will look for it. (You can see what is currently in your path by typing the env command mentioned above). The directory "~/bin" is always in your path and is a good place for personal programs/files. To run a program file though you will also need to have executable permission for that file.
In order to change the permissions for a file:
chmod XYZ filename
where X is the sum of the user permissions, Y is the sum of the group
permissions, and Z is the sum of the all users permissions.
For read permission add 4, for write permission add 2, and for executable
permission add 1. For example, to create a file which had read, write
and executable permissions for the user but only read permission for
every one else, type:
chmod 744 filename
or
chmod +x filename
which will
add executable permission to all three.
In order to change the user ownership of a file, go root and then type:
chown user filename
To change group ownership type:
chgrp -R groupname directory/filename
Or you can change both permissions at once by typing:
chown -R user.group directory/filename
(Adding the -R makes it recursive through all directories in the path
you type).
If you want to use a file/program that is in a different directory but
you don't want to actually move or copy the file/program over, you can
instead make a link to it. There are two types of links, hard and
soft. To make a soft link:
ln -s filepathtoexecutable
placetomakelinkto
for example:
ln -s
~/CVS/DataBase/Semiempirical-SRP/Utilities/EXE/GenRefGeomData .
where the "." stands for the directory you are in.
A soft link is usually preferable to a hard link, as a hard link will
delete the actual file if you delete the link.
This is often used to set up a link to an executable
from your "~/bin" directory because it allows you to run the executable
from anywhere in your directory tree.
You can also link one directory to another:
ln -s /usr/local/src/xmgr/xmgr-4.1.2/xmgr/doc/
doc
which will link the original directory to a new directory called doc
that exists in the directory you are currently in.
If you want to make up your own command name to stand for something else,
you can make an alias. Make a file in your ~/bin directory
named what you want your command to be. Then, inside of the file
put the commands that you want it to execute when you type your
command. For example, you can make a file called "sl", inside of
which is the command ls. (That way,
every time you accidentally type sl
instead of ls, it will still execute ls.) Make sure you give the file
executable permission or you won't be able to run it.
To change your printer setup, run:
printconf-gui
To restart your network:
service network restart
To have the output of a running job (program) be output both to the screen and
to a file, type:
executable < infilename | tee
outfilename
You will have to wait until the job finishes to use your command line
again however. Another way to both direct output to a file and to the
screen is to first direct it to a file:
executable < infilename > outfilename &
And then to view what is being written to your output file as the program
runs, type:
tail -f outfilename
This command can be stopped anytime with Ctrl-c without killing the actual
program that is running. The -f command for tail stand for following. You can also
print out only a certain number of lines by instead using:
tail -10 outfilename
which would print out the last 10 lines.
To see how much disk space is being used by a directory tree branch:
du -sh directoryname
To see the space used per directory in a branch:
du | sort -nr | more
To see total space used for each disk partition:
df -h
To check which jobs have run recently type:
find . -mtime -1 -print
The -1 means check everything within the last day. You can change
this to any number you want.
To find out where a job on your machine is running, first:
cd /proc/
then locate the process id (PID) directory of your job (which you can find
by running top, see below) and
look inside it to see where the executable path is.
If something running on your machine is taking up too much of your
processor, you can change its priority by 'renice'-ing it. To renice
something, first run top:
top
then type r at the cursor prompt. It will ask you which PID you would
like to renice (the PID found in the left most column).
Finally it will ask you what renice value you would like to set the
process to. Entering a positive value (something like 20) will lower
your job's priority while a negative one will raise it.
If the process you want to change belongs to another user, you will
have to be root to be allowed to change it.
Other useful top commands:
To see all the jobs a user has running type u at the top command
prompt and then enter the users name. To sort processes
by newest to oldest type A. Or to reverse order type R.
To kill (stop) a job
type k at the command prompt and enter 15 as the kill signal. (15
kills "nicely". If that doesn't work, you can use 9 instead which
kills abrubtly.)
Many other top commands can be viewed with 'man top'.
You can also kill a job on the command line by typing:
kill -15 jobid (note the minus sign
this time).
To kill only the jobs of a certain user type:
kill `ps aux | grep username | awk '{print
$2}'`
To see the parent to child branching for all processes running type,
ps afx
This will tell you, for instance,
which programs are running out of each terminal and will give you the
PID for each process too.
To convert from a ps file to a png or gif file format type:
To look at a dvi file (created with LaTeX):
To add more white space around an image:
To change your password type passwd and follow prompts. (This works
on our Linux machines too).
To temporarily (1 day) stop our Linux cluster jobs from running on your
machine:
In order to use many of the programs available on the MSI machines you
will have to load a module first. Going to
http://www.msi.umn.edu/user_support/software/all.html
and finding your desired program will usually tell you how to do this.
To make computer usage equally distributed between all users, the
supercomputers use a queuing system. You have
to submit large jobs to the queue in order to have them run (rather
than run them interactivly like you can on your own machine). To put
something into the queue system you need to make a submission script
file. The format of these files is a different
depending on which supercomputer you running are on.
For instance, on the netfinity, a multiple processor submission script
file looks something like this:
setenv MP_SHARED_MEMORY yes
charmmpar < ribo301mg_watequil.inp >
ribo301mg_watequil.out
Once you have your submission script, you then need to send it to
queue. This also varies by machine.
If you are running Gaussian jobs, however, you can have the submission
script created for you. First load the Gaussian module:
You can find out more about the queuing systems by going to
http://www.msi.umn.edu/user_support/
and selecting the link for the system you are using.
To check the status of a job that has been submitted on the
netfinity:
Once a job has been submitted you can find out how soon it will run
by:
To delete a job after it has been queued, first use qstat or llq to
find the job id. It will be something like this: "17147.ofs". Then:
To find out your disk space quota on a system:
InsightII is only available on the bscl supercomputer machines and you
may need to email them to get an account set up. To use InsightII
remotely:
To make molden stop beeping!:
To use babel on the supercomputers you will need to be in bash shell
first (just type bash at the
command prompt to get this). Then:
To turn off your computer properly, first become root. Then:
Sometimes a more useful way of transferring files between machines is
to use rsync rather than scp.
This can be a good idea if, for instance, you want to copy all of the
files in a particular directory over that are not already there but
omit the ones that are. Or you want to transfer only files that are
newer versions of similarly named files than ones already there.
There are many options for this command that can be looked up in the
man pages. One usage example:
If you have a floppy disk you want to look at the files on type:
To read a cd:
To play a cd:
To burn files onto a cd (you have to be on theory for this):
To compile a program you've written in fortran with a Makefile,
checkout the directory:
To check the spelling of a file:
To see how many lines in a file:
To install CHARMM (in serial, not parallel), go into the main directory of the
source code where the script install.com exists. (You can check out
different versions of CHARMM from "~/CVS/Software/Programs/CHARMM")
Then type:
Or, if you wanted to run a number of jobs in succession, you can
create your own submission script. First open a file named what you want your
script to be called. Then type:
To sort names or data:
To turn off beeping, go into Current Profile under the Edit menu of
one of your terminals and de-select terminal bell. You will have to
re-login for this to become permanent.
To get rid of a CVS sticky tag on a file (usually created when
checking out an older version of a file), first make a backup file, then:
To make a graph from only some of the columns in a file:
To change your screen saver run:
To send a ps or pdf file to the printer:
Some common keyboard commands in emacs:
To change to font settings of your emacs editor, left mouse click
inside the emacs buffer while holding the shift key
or go into xfontsel.
To change defaults for xemacs/emacs, look in .Xdefaults or .emacs
To have your computer beep to tell you when a job your running is
finished use:
If a file is missing a file type suffix, you can find out what type of
file a file is (text, tar, png, etc.) by typing:
file name_of_file
ps2png file.ps file.png
or ps2gif file.ps
file.gif
To convert from a eps file to a pdf file format type:
epstopdf --nocompress filename
To convert an rgb file (made with vmd) to a png file use:
convert file.rgb file.png
convert works for many other file
types as well. Such as:
convert file.png file.eps
xdvi filename
To print the output of a
dvi file:
dvips -f file.dvi > file.ps
and then open it with gv and print.
convert filename -bordercolor white -boarder
10x10 newfilename
where 10x10 specifies how many pixels of space to add.
Supercomputers
There are a number of supercomputers available for use at MSI to help
you run jobs more quickly using multiple processors. To find a full
list of your machine options go to:
http://www.msi.umn.edu/user_support/
You can also use the Linux cluster we have available in our own lab.
To find out more about what computers are available on this go to:
http://theory.chem.umn.edu/Group/Private/compinfo.html
nodemodify.pl pause computername
or to remove your computer from the Linux cluster:
nodedown
and to re-add it again:
nodeup
Note than when you are off the cluster other people can't run their
jobs in cluster queue on your machine but you can't run your on theirs either.
#PBS -l
nodes=4:ppn=2,mem=1000mb,walltime=96:00:00
#PBS -m e
cd ~/charmm/projects/
mpirun -np 8
~/charmm/projects/charmmpar < ribo379_ionequil.inp >
ribo379_ionequil.out
On the sp:
#!/bin/csh
#@ error = err.err
#@ job_type = parallel
#@ wall_clock_limit =3:00:00
#@ network.MPI = css0,shared,US
#@ node = 4
#@ tasks_per_node = 2
#@ node_usage = shared
#@resources = ConsumableMemory(500)
#@ queue
qsub scriptname (for the netfinity) or
llsubmit scriptname (for the sp)
module load g03
then create the submission script and submit it to the queue
simultaneously with:
qg03 -p 2 -t 96:00:00 -m 512mb
jobname.inp
where "-p 2" is the number of processors you want, "-t 96:00:00" is the amount
of time you want (each system has an upper limit on this) and "-m 512mb"
is the amount of memory you need. Make sure you set this to match up
with what you put in your Gaussian input file.
showq or qstat | grep username or
qstat -f jobid if you need more
information.
On the sp: showq or llq | grep username
showq can also be used to see how
many processors are available.
showstart jobid
On the sp: llcancel jobid
On the netfinity: qdel jobid
quota
To find out how many hours of allocated time you have used on a system:
acctinfo
This will also tell you how many total hours of allocation our group
has left before the current grant period ends (each July 1st and Jan. 1st).
source /usr/local/biosym/cshrc
InsightII -axxess
(It may give you some error messages but it should still work.)
xset -b
(Sorry I can't help you with InsightII).
export BABEL_DIR=`pwd`
Miscellaneous
If your computer freezes, it is best to not just shut it off. First
try going to
another computer, shh to your machine and become root. Then use the
top (see info on using top above) to kill the job
that is causing the problem.
You can also try:
Ctrl-F4
to open another session on your own computer amd run top from there.
Then to get back to your session:
Ctrl-F7
shutdown -h now
or use -r to reboot.
rsync -Wvult muscat.chem.umn.edu:/directory/*
.
which will copy over all the files of a directory that are newer than
older versions while preserving symbolic links and file modification times.
mount /dev/floppy
or if it is Windows formatted:
mount -t vfat /dev/fd0 /mnt/floppy
You will have do be root to do this or have permissions for this
device. When you are done, unmount the disk with:
unmount /dev/fd0
mount /dev/cdrom
cd /mnt/cdrom
Some of the newer LINUX versions will mount things like disks, cds and flash
drives automatically.
xplaycd &
cdrecord -vv -dev=cdrw -blank=fast -dao -pad
-audio filenames
~/CVS/Software/Configure
and copy the file prog.mk to the
directory your program is in. Edit the file to be specific for your
program. Then type:
configure
(which should be in
your path) to create your Makefile. Now to compile your code type:
make
If you do not have a Makefile you can compile with:
f95 filename
ispell filename
Emacs also has a spell check option under the Tools menu.
wc -l filename
./install.com machinetype memorysize
You can use "large" on our machines or "xlarge" on the supercomputers for
the memorysize and for machinetype use: "gnu" for Linux,
"ibmsp" for the sp, etc. A list of possible types as well as other
compiler options, can be found inside the install.com script file.
To install CHARMM in parallel, use instead:
./install.com machinetype memorysize M
MPICH
You will be prompted for where the mpi include and mpi lib files
are. This changes as upgrades are made but you can find what's
current by going to:
http://www.msi.umn.edu/cgi-bin/soft/software_detail.html?id=225&lab_id=&subject_id=30.
Currently on the netfinity they are:
/usr/local/mpich-gm-rhel3/include
/usr/local/mpich-gm-rhel3/lib
These may be different depending on which libraries your platform
uses though. You can also see our message board for more details.
When recompiling charmm, especially if you are making changes to the
code itself, you may need to delete the platform directory created
within the lib/ and build/ directories. For example:
rm -rf build/gnu
rm -rf lib/gnu
Don't delete the entire lib/ or build/ directories though or you will
lose files you need to compile!
To follow the output of the compilation:
tail -f build/gnu/gnu.log
where gnu is the computer platform type you are using.
for i in `ls *.dat`
do
mv $i `echo $i|sed 's/dat/txt/'`
done
This will substitute "tex" for "dat" in each filename that ends in "*.dat".
#! /bin/sh
name="job1.inp job2.inp job3.inp
job4.inp"
for i in $name
do
g03 < $i > `echo $i|sed 's/inp/out/'`
done
Add executable permission to the script and then run it with:
nohup ./script &
(Be careful to keep back-ticks and apostrophes strait and don't use a
& in the g03 command line or the jobs will try to run all at once!)
for i in `ls *.xyz`; do echo $i; done |
sort
which sorts alphabetically. To instead sort numerically use sort -n
(or sort -nr for reverse order).
Please note that these commands are specific to bash shell. If you are using a
different shell (such as on the supercomputers which use c-shell by
default) you will need to either change to bash shell temporarily:
bash (to enter)
exit (to leave)
or use commands specific to c shell instead. For example:
foreach i (`ls *`)
do
mv $i `echo $i|sed 's/dat/txt/'`
done
cvs update -A
To get a previous cvs version of a file, first:
cvs log filename
to list all previous versions, then:
cvs update -r version filename
xmgrace -block filename -bxy 2:3
where -bxy 2:3 tells xmgrace which columns to use for the x & y axis
xscreensaver
lp -d lpc -P 1-2 filename
where "lpc" is our color printer (you can also use "lpbw" for our black &
white printer) and "-P 1-2" is the pages to print (can be left out if
there is only 1 page or you want to print the whole file). To view
the print jobs you have submitted:
lpq
to cancel a print job:
cancel jobid
(You have to be quick though!)
Alt-w to copy
Ctrl-w to cut
Ctrl-y to paste
Ctrl-x Ctrl-l to lower case text
Ctrl-x Ctrl-s to save
Ctrl-x Ctrl-c to close buffer
Esc-< to move to beginning of buffer
Esc-> to move to end of buffer
Esc % to replace text
Ctrl-g to abort a command
Ctrl-a to move cursor to the beginning
of line
Ctrl-e to move cursor to the end
of line
Esc lpr-buffer to print an emacs
buffer without the header
Many of these commands can also be found in the toolbar menus.
program < inputfile && cat
/usr/share/sounds/KDE_Beep_Beep.wav > /dev/audio
(Very useful if you have your computer set-up to have more than one
workspace screen). Depending on what you have installed you may or
may not have this
specific wav sound file but you can look through the directory to
find another one you do have.
Back to my home page