Professional Documents
Culture Documents
Introduction To The Maths Computer System: August 11, 2016
Introduction To The Maths Computer System: August 11, 2016
System
The first part introduces the local services. Even if you know
Unix you should read this section.
The second part introduces Unix. We hope there is enough
there to keep you afloat until you can attend the Universitys
Introduction to Unix course.
The third part is a glossary of Unix terms. It will include some
extra commands not covered in part 2.
1
Assistance: The Helpdesk
http://www.maths.cam.ac.uk/computing/
To contact us by email
help@maths.cam.ac.uk
really-urgent@maths.cam.ac.uk
http://www.ucs.cam.ac.uk/linkpages/newcomers
2
Part I: Local IT Services
http://www.maths.cam.ac.uk/computing/comptable/
https://help.ubuntu.com/
3
Laptops, Tablets and Smartphones
Connecting your laptop to any other port will not work. This
includes your desktops port since that is on a different network.
If you need to use this network and there are no laptop network
ports available in your office, please contact us by emailing
help@maths.cam.ac.uk with your office number and if possible the
number of the free network port you need to have added to the laptop
network.
https://www.maths.cam.ac.uk/computing/laptops/
https://www.wireless.cam.ac.uk/person/self/usage/
(wireless)
http://lapserv.maths.cam.ac.uk/authstatus/ (wired)
4
Virus Checker
Please make sure any computers you use other than the department
computers have up-to-date virus checkers on them. The University
has a license for some products which you can use free of charge.
http://www.ucs.cam.ac.uk/support/anti-virus/
5
Linux Computers
http://www.maths.cam.ac.uk/computing/comptable/
Enter your CRSid to see just the computers to which you have login
access.
If the computer you want to use is switched off, you can switch it on
over the network with wake computer name from the command line
or via this web page.
https://things.maths.cam.ac.uk/it-admin/wakeup.
cgi
http://www.maths.cam.ac.uk/computing/policy/longjobs.html
6
Windows Computers
http://www.maths.cam.ac.uk/computing/mcs/
$ windows_applications &
On this you will find all the standard Microsoft Windows programs
as well as some mathematical software.
http://www.maths.cam.ac.uk/computing/win7/
7
Printing and Scanning
Each pavilion has at least one public scanner and a number of public
printers. In general you have access to all of these. The webpage
below provides the locations and instructions for use of these.
http://www.maths.cam.ac.uk/computing/printing/
There are two poster printers. Please carefully check any conference
posters for errors before printing the final version on the poster
printer.
http://www.maths.cam.ac.uk/computing/printing/
poster.html
8
Printing Tips and Rules
If a printer isnt working the best thing to do is remove your job from
the printer queue (use the lprm command) and send it to a different
printer.
Please use black and white printers where possible because the
colour printers cost three times more to print the same black and
white page.
http://www.maths.cam.ac.uk/computing/printing/
cant_print.html
http://www.maths.cam.ac.uk/computing/printing/
rules.html
9
Remote Access
Whichever departmental Linux computer you log into you will see
the same files (home directory) and the same environment. If your
office is moved, there is no need to move your computer.
http://www.maths.cam.ac.uk/computing/win7/winex.
html
The Linux computers shut themselves down when idle and unused
to save energy, but ssh.maths.cam.ac.uk is always switched on.
http://www.maths.cam.ac.uk/computing/remoteaccess/general.
html
If you are using a laptop and want to see your department home
directory from it see:
https://www.maths.cam.ac.uk/computing/laptops/
homedir.html
10
Quota and Backups
Your home directory (where you store files by default) has a quota
and is backed up regularly. If you delete or overwrite a file you
wanted please refer to
http://www.maths.cam.ac.uk/computing/files/
backups/deletedfile.html
Up in the top right hand side of your desktop is a quota icon. If you
hover your mouse over the square with a percent in it, you will see
how much quota you have and how much you are using. The quota
command will give you the same information from the command
line.
http://www.maths.cam.ac.uk/computing/files/quota.
html
11
Additional File Storage
You have access to additional file space in the store spaces. These
have no quotas and only limited backup (two weeks of). Like your
home directory, the store spaces are accessible from any department
Linux computer.
We also have scratch spaces which are the hard disks of different
computers and are accessible only from the computer itself. These
are wiped when a computer is reinstalled. They are useful if you
want to write a file directly instead of across the network.
http://www.maths.cam.ac.uk/computing/files/scratch.html
12
Email and calendars
https://webmail.hermes.cam.ac.uk/
http://www.ucs.cam.ac.uk/email
http://www.ucs.cam.ac.uk/email/muasettings
http://www.ucs.cam.ac.uk/mobiledevices
http://www.ucs.cam.ac.uk/googleapps/calendar.html
13
Your @cam address and the lookup service
http://www.lookup.cam.ac.uk/
Please also check and fill out the other information on your
University lookup page. You can do this as soon as you have a Raven
account. The lookup service is used to search for people and for the
university email address book service.
14
Email Lists
http://www.maths.cam.ac.uk/internal/email_lists/
https://lists.cam.ac.uk/mailman/
http://www.ucs.cam.ac.uk/email/lists/listmanaging.
html
http://www.ucs.cam.ac.uk/email/lists
15
Computing News
http://www.maths.cam.ac.uk/computing/news/
Note: If you are writing code that will run over a number of days,
we recommend you checkpoint it. While the Wednesday morning
reboots are planned, sometimes we have a power cut or someone
accidentally switches off a computer.
http://www.maths.cam.ac.uk/computing/policy/longjobs.html#
Preparing
https://lists.cam.ac.uk/mailman/
16
Software
http://www.maths.cam.ac.uk/computing/software/
If we dont have software you need and it is free, you can try to install
it yourself. Some members of the department make their installed
code available for others to use. This saves multiple people from
installing the same code.
http://www.maths.cam.ac.uk/computing/software/
own.html
http://www.maths.cam.ac.uk/computing/software/
user-maint.html
http://www.training.cam.ac.uk/ucs/theme/unix?providerId=
36407
The UCS also sells software, but generally not for personal use so it
is best to ask us to order any software you need.
17
Scientific Computing
http://www.maths.cam.ac.uk/computing/hpc_sci/
http://www.maths.cam.ac.uk/computing/mpi.html
http://www.training.cam.ac.uk
18
Guests and Visitors
If someone comes to visit you and theyd like WiFi access, generate
a wireless ticket for them here (select Colleague Tickets tab).
https://www.wireless.cam.ac.uk/person/self/
19
Privacy
All files you create on the department system are by default private
(readable only by you) and your email is also private.
If you want new files you create to be readable by other people, edit
the line at the end of your .bashrc file
umask 0077
to read
umask 0022
It is expected that people will not look at files not belonging to them
which they have no good reason to look at.
20
Purchases
If you wish to buy a computer from your research grant funds, please
first check
http://www.maths.cam.ac.uk/computing/buying/
http://www.ucs.cam.ac.uk/support/
hardware-support/hwoverview
Broken Computers
21
Sharing Resources
http://www.maths.cam.ac.uk/computing/policy/longjobs.html
In store and scratch spaces, look at the total space available (df -h .).
Archive and compress or remove your files as you finish with them.
When a space fills a lot of people are inconvenienced.
Please remove personal data from the system before you leave.
It is impossible for the computing staff to know which files left
behind are left intentionally to share with others, and which are
left by accident. Clearing files when you leave frees up space for
newcomers.
If you are using the shared software area, make sure you keep your
index file up to date so that others can see what software you are
sharing with them.
http://www.maths.cam.ac.uk/computing/software/
user-maint.html
Leave public computers in a good state and report any problems with
them to the helpdesk.
22
Miscellaneous
http://www.maths.cam.ac.uk/computing/powersaving.
html
If you get pain in your arms, wrist or hands from typing, STOP and
take a break. Dont make it worse by continuing to type. The internet
has enough stories of people who could not work for months because
they ignored initial work related upper limb disorder pain.
http://www.uis.cam.ac.uk/health-and-safety/
upper-limb-disorders
23
Part 2 - Introduction to Unix
24
Education and Learning (basic and advanced)
If you have not used Unix before (or only used it for web-browsing
and email) please attend the UCS Introduction to Unix Course as
soon as possible. We strongly recommend this course.
The course runs over two half day sessions and is repeated several
times throughout the year.
http://www.training.cam.ac.uk/ucs/event/721643
For more advanced use of the shell and command line, please attend
the Simple Shell Scripting For Scientists course.
http://www.training.cam.ac.uk/ucs/event/722116
http://www.training.cam.ac.uk/ucs/theme
and choose the topic from the left-hand menu e.g. Unix (including
Linux) Systems & Use or Scientific Computing.
http://www.maths.cam.ac.uk/computing/linux/unixref.html
25
Starting
Other desktops may not be customised for the Maths system as much
as Xubuntu is. In particular they do not all have the quota icon or a
customised menu to the Maths applications (Applications Maths
Programs).
When you have finished working on your computer, please log out
by selecting Log Out from the System menu. This will allow it to
shut itself down to save energy.
To reset your desktop to the default state, type xreset.sh, log out
and select the Xubuntu desktop (from an icon at the top right of the
login screen) before logging back in.
26
Shortcuts
The cursor keys (left and right, up and down) allow editing of the
current command and recalling of previous commands in an intuitive
manner.
Note also that pressing {TAB} when part-way through typing a file
name will cause the rest of the file name to be filled in automatically
if it is unique. This trick also works for command completion (type
his then press {TAB}).
The wild cards ? and * can be used to stand for any one character,
and any string of characters respectively:
In this way the CLI is much more powerful than using the mouse
and the file-manager.
27
Filenames
The only character which is absolutely forbidden in a Unix filename is /, because this
separates the components of a path like /home/eva/test files.
28
Programs and Applications
People tend to use the term program when they use the Command
Line Interface (CLI) to type in the name of the program, and
application when they click a menu item or double click an
application icon.
crsid@machine: $
means your home directory, user1 means user1s home directory.
29
Starting Programs and Applications
From the CLI programs which are on your PATH are started by
typing their name:
$ firefox &
(the & sign causes a background process. This means you get
your prompt back immediately so that you can start other programs
without waiting for the firefox program to exit.)
The PATH and where a program is found on the PATH can be seen
with
$ echo $PATH
$ type firefox
Not all the locations you will put programs are on your PATH. To
start a program you have downloaded (e.g. with firefox):
$ cd Downloads
$ ./prog-01
(Without the & this is a foreground process. This will run the
program from the CLI and only return you to the shell prompt when
the program finishes/exits.)
You will learn more about this on the recommended CLI course.
30
Home Directory
$ cd
$ ls
private/ public_html/ shared/
public/ results.dat thesis.tex
Regardless of which Unix computer you log into, you will always
start in your home directory. This means that you can use any of the
computers in your office or on the benches.
31
Quota
As explained in Part One your Home Directory has a quota. The icon
at the top right hand side of your screen shows your quota usage.
Alternatively you can check your quota with the CLI:
$ quota
Disk quotas for user evatest3 (uid 1016):
Filesystem blocks quota limit grace files quo
rpc-serv1.maths.cam.ac.uk:/local/home/stats
83972 2097152 2097152 1337
To get more quota email help@maths and specify how much more
quota you need.
32
Hidden Files
$ ls -a
.bashrc .emacs .gconfd/ .gnome2/ .login .vimrc
Only edit these dot files if you know what youre doing. An error
in these can prevent the associated application from working or lock
you out of your account. If you do run into difficulties from trying
to modify these files email help@maths.cam.ac.uk.
You can learn about the commands in your .bashrc file with
man bash
33
Who can read your filespage 1
You can also change who has access to your files with the CLI. This,
while initially harder to learn, is useful when you have many files
you would like to update at once.
34
Who can read your filespage 2
By default no-one else can read any of your files. To make all
your new files readable by everyone else on the system, replace the
umask line at the end of your .bashrc with
umask 0022
35
Who can read your filespage 3
$ ls -l thesis.tex
-rw-r--r-- 1 crsid group 3410 Oct 12 15:13 thesis.tex
l link
Access permissions:
File Directory
r Readable ls works
w Writable File deletion and creation work
x eXecutable Can access files within directory.
36
Creating Documents
Text editors are used to edit plain text files. This includes source code
e.g. shell, C or Fortran programs, LATEX, and HTMLbasically,
anything you can type in. Windows has a very basic text editor
called Notepad. Linux has more advanced text editors which can
automatically highlight parts of your source code in different colours
to make it easier to read.
Text editors are usually started from the command line, or can be
found in the menus under Applications Accessories. Of the many
text editors available, we know most about emacs, gedit and vim.
37
LATEX
http://www.training.cam.ac.uk/ucs/event/721788
The # sign indicates that the rest of the line is a comment which the computer will ignore.
You do not need to type these, but if you are cutting and pasting from an electronic form of this
booklet it is harmless to leave them in.
38
Viewing files
For text files there is no need to open an editor just to view their
content. To view a file using the mouse, double click on that file. If
this fails, right-click and choose a program to view the file with.
To view a text file with the CLI use the command cat or less.
less will show you the file page by page while cat will display
the whole file at once and you may need to use the terminal scroll
bar to see the beginning of the file.
For non-text files like PDF files, use the appropriate installed
software readers, for example evince for PDF files:
If you do not know what to use to open the file try using:
$ xdg-open thing.jpg
cat is also useful for merging the content of two or more text files.
$ ls
paper1.txt paper2.txt
$ cat paper1.txt paper2.txt > papers-combined.txt
$ ls
paper1.txt paper2.txt papers-combined.txt
Use > to send output to a file, and >> to append output to a file.
Use | to send the output to the input of another command.
For example to display all processes, one page at a time:
$ ps -A | less
39
Simple File Operations
$ ls
result.dat thesis.dvi thesis.tex
$ cp thesis.tex new_book.tex
$ rm thesis.dvi
$ mv result.dat results.dat
$ ls
new_book.tex results.dat thesis.tex
The best way to learn all file operations using the graphical file
manager is to experiment and read through the help pages (from the
File Manager window, Help Contents Read Online).
Files in the Rubbish Bin are not actually deleted and still count
towards your quota though they are not backed up. To empty
your Rubbish Bin, double click on the Rubbish Bin icon on your
desktop, then File Empty Wastebasket.
40
Tidiness
$ mkdir test
$ ls
thesis.dvi results.dat thesis.tex
private/ test/
$ rmdir test
$ ls
thesis.dvi results.dat thesis.tex
private/
$
For the adventurous you can remove directories with contents (and
all sub-directories) using the rm command with the -rf options:
$ rm -rf stuff
Be careful!
41
Where Is It?
If you created a file but you cant remember where you put it, there
are various search mechanisms.
hlocate thesis
http://www.maths.cam.ac.uk/computing/files/finding.html
If it turns out that the file was deleted rather than simply mislaid, see
the earlier page on backups.
http://www.maths.cam.ac.uk/computing/files/
backups/deletedfile.html
42
Trees
Directories form a tree: each directory has one parent directory, and
may have multiple sub directories. A file name is assumed to refer
to the current directory. Other locations can be specified by forming
a path using / to separate the components of the path, .. to refer
to a directorys parent, . to start a relative path and / to start an
absolute path.
$ ls -F
a/ results.dat
$ cp results.dat a/results.dat
$ ls -RF
.:
a/ results.dat
./a:
results.dat
$ ls ./a
results.dat
$ mkdir b
$ cd b
$ cp ../a/results.dat .
$ cd ..
A similar tree effect can be seen with the File Manager by using
View View as List and expanding and collapsing the directories.
Recursion
For example you may want to stop a program running, maybe you
opened xv to see what it did and now cant get out of it. From
another terminal or xterm use the killall command.
$ killall xv
If that fails, try to force the process to shut down, although this gives
the application no opportunity to shut itself down neatly.
$ kill -KILL 1234
44
Sharing Resources
The Maths online documentation has a list of rules for running code
and advice on how to make your program nice to both the system
and other users. Following these rules allows others to use the
computer while your code is running. This is essential on our shared
network.
http://www.maths.cam.ac.uk/computing/policy/longjobs.html
$ cat /etc/motd
45
Large Files
Data files tend to be large. Often too large for storing in your home
directory. Programs that write data to your home directory may quit
unexpectedly when your quota fills up. store areas, described in
Part 1, are dedicated storage typically used for long term storage of
data.
To see which store areas you have access to, type store-space.
Everyone has access to their departments store area and some
research groups have paid for store areas of their own.
To create your store space in one of the areas listed, type e.g.
Owing to the automounter only having the store areas actually in use
mounted at any given time, you cannot access /store/DPMMS via
the GUI without first going via the command line. To get around
this you can create what is called a symbolic link
$ cd
$ mkdir mydata
$ cd mydata
$ ln -s /store/DPMMS/crsid/ mystorespace
Now when you double click on your folder mydata, you will see
mystorespace. Double clicking on it will bring you direct to the
store space you created.
46
Where to Store FilesScratch Spaces
When your code has finished move the datafile to a more reliable
storage place, for example /store space, if you want to keep it.
$ cd /local/scratch/public/
$ mkdir /local/scratch/public/crsid
47
Accessing Maths Computers Remotely
http://www.maths.cam.ac.uk/computing/comptable/
You can wake up computers from here if they are powered down.
$ ssh computer1
$ ssh -C -Y crsid@ssh.maths.cam.ac.uk
http://www.maths.cam.ac.uk/computing/remoteaccess/general.
html
48
File Transfer
Copy files from your laptop to a Maths data area (this copies the
directory laptop data into /data/septal/crsid):
Note that the EOL \ means the command continues on the next line.
See also
http://www.maths.cam.ac.uk/computing/files/
linux_file_transfer.html
49
Conclusion
http://www.training.cam.ac.uk/ucs/event/721643
Should you really, really not have time to attend this half day course,
you can download, print and read the course notes instead.
http://www.ucs.cam.ac.uk/docs/course-notes/unix-courses/
UnixCLI
Leaving learning these skills until the last minute when you have
a thousand data files to manipulate and no time to learn, means
repeating the same action over and over and over and over. . . . The
shell and CLI provide tools to greatly simplify this sort of activity.
50
Part 3 - Glossary of Terms
This section lists some useful command and summarises their use.
To find out more about any of them run man command-name or use
google.
awk
Manipulates files.
bash
Default shell. Look for Bash unix shell on wikipedia for a brief
history and list of keyboard shortcuts. For more information man
bash.
bunzip2
Uncompress a file.
bzip2
cal
Shows this months calendar. For the whole year run cal 2016.
cd
51
cd when given an argument changes to that directory
cd /store/DAMTP/crsid
cat
Display a file.
chmod
cp file1 file2
Copy file one to file two. Be careful. This may overwrite file two if
it exists.
date
du dirs. . .
Show disk usage of the directories. Useful when you are running
down on quota and trying to figure out where your space is used up.
To list your files and directories by size, typically from your home-
directory run du -sk * .??* | sort -n
52
Show differences between two files.
echo text
emacs
env
file filename
Guess the type of file. Useful when a file has no extension (.pdf, .txt
etc). While it is not always accurate, if it says that a file is any sort
of text, you can safely read it without messing up your screen.
find
find . -name test Find all files starting with the string test
under the current directory.
firefox
Web browser.
53
firefox -ProfileManager start firefox by creating or selecting a new
profile. It can be useful to try a new profile when something
goes wrong and you cant tell if its your firefox or happening for
everyone.
gedit
gvim
head filename
history
LATEX
54
kile
GUI LATEXprogram.
kill
killall program-name
less filename
lpr file
lpq
ls
55
List contents of directory.
To list contents with sizes etc., and sorted by modification time ls -ltr
man command
On-line manual.
mkdir directory
Make directory.
mv file1 file2
pico
Unix editor.
pine
Email program.
ps
quota
56
Show filespace quota.
rm filename
Deletes Files.
rmdir directory
sed
text replacement.
ssh computer-name
sort
tail filename
texstudio
thunderbird
Email program.
tidy
57
$ tidy -asxhtml file.html > newfile.html
time command
top
tr
Changing characters.
vim
wc filename
whereis program-name
who
xdg-open
58
Open a file. This program will take a guess at what file type a file is
and open it with the appropriate piece of software.
xterm
59
*, 27 xdg-open, 39
/, 43 xterm, 29
?, 27 xv, 44
>, 39
>>, 39
backups, 11
cat, 39
cd, 31, 41
chmod, 34
cp, 40
evince, 39
groups, 34
home directory, 31
kill, 44
killall, 44
less, 39
ls, 31, 36, 43
mkdir, 41
mv, 40
path, 30
permissions, 36
ps, 44
rm, 27, 40, 41
rmdir, 41
terminal, 29
text editors, 37
wild cards, 27
60