UNIX tutorial
6 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
6 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

UNIX tutorialUNIX is a an operating system, like Windows or MacOS. The flavors of UNIX we use are IRIX(by Silicon Graphics, Inc or “SGI”) and Linux.Our computersSGI workstations (1 processor each): algonquin, colden, nye, panther, streetLinux workstations (1 processor each): blake, dial, eastdix, emmons, porterSupercomputers (32 processors each, both SGI):Marcy (owned by Hamilton College)Olympus (shared with 6 other schools in MERCURY consortium)Server computers (all SGI) (small queue of Marcy, 4 processors each): giant, gothics, haystack, skylight, whiteface(small queue of Olympus, 8 processors): VesuviusNotes on working with SGI computers:1. You have to have your mouse inside the window you want to type in.2. To call a window to the foreground, click on its title bar.How to use UNIX:0. Log out the previous user (after asking him or her, of course) if necessarya. On SGI, in the toolchest, select Desktop>Logout.b. On Linux, select Logout from the red hat menu in the bottom left corner.1. Log in. Enter your username and password. Don’t be alarmed if you can’t see yourpassword as you type it.2. Open a UNIX shella. On SGI, in the toolchest, select Desktop>Open Unix Shellb. On Linux, right click-hold and then select Open Terminal from the menuthat appears.General UNIX/Linux command line entrieswhoami reveals username of current userhostname reveals computer you are usingpwd print working directoryNote that the first three of these are usually ...

Informations

Publié par
Nombre de lectures 23
Langue English

Extrait

UNIX tutorial
UNIX is a an operating system, like Windows or MacOS.
The flavors of UNIX we use are IRIX
(by Silicon Graphics, Inc or “SGI”) and Linux.
Our computers
SGI workstations (1 processor each): algonquin, colden, nye, panther, street
Linux workstations (1 processor each): blake, dial, eastdix, emmons, porter
Supercomputers (32 processors each, both SGI):
Marcy (owned by Hamilton College)
Olympus (shared with 6 other schools in MERCURY consortium)
Server computers (all SGI)
(small queue of Marcy, 4 processors each): giant, gothics, haystack, skylight, whiteface
(small queue of Olympus, 8 processors): Vesuvius
Notes on working with SGI computers:
1.
You have to have your mouse inside the window you want to type in.
2.
To call a window to the foreground, click on its title bar.
How to use UNIX:
0.
Log out the previous user (after asking him or her, of course) if necessary
a.
On SGI, in the toolchest, select Desktop>Logout.
b.
On Linux, select Logout from the red hat menu in the bottom left corner.
1.
Log in.
Enter your username and password.
Don’t be alarmed if you can’t see your
password as you type it.
2.
Open a UNIX shell
a.
On SGI, in the toolchest, select Desktop>Open Unix Shell
b.
On Linux, right click-hold and then select Open Terminal from the menu
that appears.
General UNIX/Linux command line entries
whoami
reveals username of current user
hostname
reveals computer you are using
pwd
print working directory
Note that the first three of these are usually redundant, as they appear before every command
line.
cat
file
con
cat
enate: displays the contents of a
file
within the UNIX shell
cd
c
hange
d
irectory: the command cd directory will open a subdirectory of the
current directory; typing “cd ~” will return you to your home directory
(/home/hamilton/pchem); “cd ..” will move you up one directory (from /
home/hamilton/pchem to /home/hamilton).
cp
file1
file2
takes
file1
, which exists, and
c
o
p
ies the contents into a new file called
file2
.
As
written, this command will put file2 in the same directory as file1. [see also mv]
exit
exits a computer or user, depending on context (synonymous with logout)
head –50 file
shows the first 50 lines of file within the UNIX shell
tail –20 file
(you can probably guess what this does; note you get to pick the number of lines
to show, or you can omit the –
n
argument and accept a default amount)
kill 3214
kills the process whose PID number is 3214 [see also top]
ls
l
i
s
ts the contents of a directory
lp
print command
grep
string
file
search a
file
for the specified
string
of characters.
For example, the command
“grep energy gausian.log” will search the file gaussian.log for the word energy,
and then display every line in the file which contains the word energy.
Useful
for finding a needle in a haystack (if you know what the needle looks like).
man
man
ual pages (e.g., to find out more about ls, type “man ls” into a UNIX shell)
mkdir
bruno
m
a
k
es a
dir
ectory called
bruno
(directory and file names aer case sensitive)
more
file
shows contents of
file
one screen at a time
mv
renames files or
m
o
v
es them among directories
e.g., mv file1 file2 renames file1 (which exists) as file2 (which does not exist)
e.g., mv file1 /home/hamilton2/tevans/file1 takes file1 out of wherever it is and
puts it in my home directory.
Note that I could change the name of file1 if I
wanted; by default the name remains the same.
rlogin
host
r
emote
login
to a different
host
(computer), e.g. rlogin olympus
rm
file
r
e
m
oves
file
(USE WITH CAUTION: ONCE IT’S GONE THERE’S NO
GETTING IT BACK).
If you should happen to learn any shortcuts that remove
more than one file at once, MAKE SURE YOU KNOW WHAT YOU’RE
DOING.
rmdir
r
e
m
oves empty
dir
ectories, rmdir will not delete directories which are not
empty
top
gives information about how much of a computer is being used and what it’s
doing
ftp
host
“file transfer protocol” logs into the specified
host
, using an ftp shell, as the
name implies, this is a useful command for transferring files via the command
line
get
file
An ftp command used to copy a
file
from a remote location, and copy it to the
local machine.
The Queuing System
Marcy and Olympus have queuing systems to optimize and organize computer resources.
The queues are…
(for Marcy)
large_queue
These jobs run on Marcy itself
small_queue
These jobs are delegated to Giant, Gothics, Haystack, Skylight,
or Whiteface based on availability (you don’t get to pick).
(for Olympus)
large_queue
These jobs run on Olympus itself
small_queue
These jobs are delegated to Vesuvius.
Hence, you only submit jobs to Marcy or Olympus, but these jobs may be delegated to smaller
computers.
To submit a job to Marcy or Olympus, you need use a
.run
(“dot-run”) file, which
tells the queuing program what computer resources you need, what job you want to run and
which program you want to use on your job.
An example run file is given below.
#PBS -N testjob
#PBS -l ncpus=4
#PBS -l mem=1GB
#PBS -q large_queue
#PBS -M slyoung@hamilton.edu
#PBS -m bea
#PBS -j oe
cd /home/hamilton/pchem/jobs
g03 home/hamilton/pchem/jobs/testjob.com
Here is an explanation of what each line does:
#PBS -N testjob
Name of the job. If omitted, uses filename.
#PBS -l ncpus=4
Number of CPUs to be used for the job.
#PBS -l mem=1GB
Amount of memory, in MB or GB, to be used.
#PBS -q large_queue
Name of the queue to run job under.
#PBS -M slyoung@hamilton.edu
Your email address.
#PBS -m bea
Email you when job
b
egins,
e
nds and
a
borts.
#PBS -j oe
 
Merge PBS output and error files.
Note:
This section is “blank line terminated” – you must have an empty
line between here and the next part.
cd /home/hamilton/pchem/jobs
Opens the directory that the input file is in
g03 home/hamilton/pchem/jobs/testjob.com
Command line option: runs the program g03 on the specified command file (testjob.com).
Note that you will probably have to change the “g03” part if you want to run Amber
instead of Gaussian 03.
Note: That you must have an empty line at the bottom of the
.run
file.
It is usually easier to modify a run file that has already been created than to make one from
scratch.
You may copy a generic run file from me by using the following command (suppose
you’re Kate Schirmer and you want to put this in your directory):
cp /home/hamilton2/tevans/run /home/hamilton/pchem/schirmer/
I’ve also put this file in the pchem home directory, but there it can be adulterated by other pchem
users.
Kate could also get this .run file from anywhere in the pchem directory with
cp ~/run ~/schirmer/
Some people find it useful to keep file names analogous (i.e., the run file for filename.com
would be filename.run).
Since some people are working in groups, if you both want e-mail notification of your jobs, you
can add an extra line, e.g.,
#PBS -N testjob
#PBS -l ncpus=4
#PBS -l mem=1GB
#PBS -q large_queue
#PBS -M 
slyoung@hamilton.edu
#PBS –M tmevans@hamilton.edu
#PBS -m bea
#PBS -j oe
Submitting your job
Say your
.run
file is called run and is in the directory /home/hamilton/pchem/schirmer/
Then the following can be used to submit your job to Marcy:
rlogin marcy
cd schirmer
qsub run
Then you can check on the status of your job by typing
qstat –a
Make sure you are logged into the machine you submitted your job to when typing qstat.
Note: R=running, Q=queued, E=error .
Talk to a Professor if
your job has an ‘E’ next to it.
You may kill jobs by looking at the job id number in the lefthand column of the qstat printout
(say it’s 5544) and then typing
qdel 5544
Note that users normally can only kill their own jobs, however since you all share the same user
account you can all (accidently) delete each others jobs.
Be careful with the qdel command!
Editing files
To edit a text
file
issue the following command:
nedit
file
&
This command will open
file
in a text editor called nedit.
Once you get into nedit you should
feel pretty comfortable.
If you exclude the filename, nedit will open to a blank document.
The
ampersand “&” at the end of the command instructs the computer to execute the command in the
background so that you may use the UNIX shell at the same time.
Force Quit Command:
From anywhere in a UNIX shell, no matter what mess you get yourself into, if you hit <ctrl-c>
the computer will stop what it’s doing and give you a fresh command line (quitting any
processes that are running but not in the background).
Be courteous and logout when you are done.
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents