IT Help & Support

Studying at Cambridge

## Managed Cluster Service (MCS)

The Managed Cluster Service (MCS) provides open-access managed desktop workstations for the use of all staff and students at the University. It provides networked computers on Windows, Linux and Mac platforms, running a wide variety of software, as well as managed printers and scanners.

## Managed Cluster rooms

UIS runs a number of public rooms ('Managed Clusters'), and many Colleges and Departments also have similar rooms for the use of their own members.

MCS computers provide access to a wide range of software as well as your Desktop Services central filestore (known as DS-Filestore), and to central printing facilities (DS-Print).

## Opening hours and locations

The service runs 24/7, subject to occasional downtime for scheduled work. Some MCS rooms (those managed centrally by UIS) are also designated Teaching Rooms which may be booked for courses at certain times.

Some rooms offer Windows, Macintosh and Linux platforms; others only one or two.

UIS Managed Cluster rooms

MCS operating systems and hardware

## Logging in to an MCS computer

When you log in, you are automatically connected to DS-Filestore (your Desktop Services filespace). You can also access this from any other Internet-connected system.

## Remote access

DS-Filestore and DS-Print can be accessed from your own computer or mobile device, from elsewhere on the network.

### Windows and Mac OS applications

MCS Windows and Macintosh applications (e.g. office software, teaching programs) can not be accessed remotely from outside the MCS (e.g. from machines in college rooms).

## Help and support

To help you use the software on the MCS computers, libraries of information are available in the UIS public rooms, from the UIS Service Desk and in other Managed Clusters rooms.

## Accessibility

For information about physical and software aids to accessibility, and other specialist facilities for users with additional needs, please see:

Accessibility and UIS facilities

## Desktop Services user accounts

Your Desktop Services (DS) account gives you access to all DS services: your personal filestore (DS-Filestore), use of the managed workstations (the MCS service) provided in several locations around the University which give you access to a wide variety of software on popular platforms, to printing facilities (DS-Print), and the ability to publish personal or group web pages (DS-Web).

## Getting a Desktop Services account

Desktop Services accounts are included with your UIS computing account (along with Raven authentication and Hermes email). All students and many members of staff are given DS accounts automatically when they join the University, and will be given instructions on how to collect their login name and initial password, usually before they arrive in Cambridge.

Any other member of the University or group may apply for a Desktop Services account.

Student accounts are normally cancelled at the end of the student's course, and staff or visitor accounts when the individual leaves the University. More details of the cancellation schedule are available:

Your password must never be given to another user. Anyone who knows your password can not only damage or destroy your files, and use your printing quota, but may send email in your name, use your account as a base for Internet hacking or dissemination of illegal material, and potentially cause damage far beyond your own account and your own files.

How do I change my UIS Password?

## File access and security

The first and most important steps in keeping your files and your computer account safe are choosing a good password and keeping it secret.

It is your responsibility to backup your Desktop Services files. System backups are kept in case of hardware failure, but it is not normally possibly to restore individual files lost through user error.

By default nobody else (logged in under their own name) can read or do anything else to your DS-Filespace files. You can give permission for other users to read, modify or create files in your filespace.

If you fail to log out of Desktop Services when using a machine in a public room, then anyone can sit down at the machine you were using and do anything that you could do to your files. Similarly, anyone who obtains your password can pretend to be you and read or delete your files.

If you leave files on the hard disk (C: drive in Windows) of your Managed Cluster machine, then anyone coming after you can read them, and they are likely to be deleted anyway within a day or so, since the hard disks are regularly purged.

## Using an MCS Windows PC

The Help available from the Start menu (under Help and Support) is useful, but note that it is specifically about Windows as supplied, and may not match exactly what is provided on the MCS.

Note that the use of Linux on the MCS PCs is not described on this page. Restart an MCS PC to run Windows if it has been left by a previous user running Linux.

## The MCS PC desktop

After you have logged in to a MCS PC you will see, at the bottom left of the screen, the Start button which you use to carry out most tasks on the PC. When you click Start, Windows displays a 'Start panel' which includes the following useful items, among others:

• All Programs: the full range of utilities etc. supplied with Windows: opens as you pass the mouse over it
• Documents: your personal Desktop Services filespace (same as the desktop icon)
• Computer: open this to see all devices (disks etc.)
• Devices and Printers: open this to select a printer or check print queues
• Help and Support: general Windows information, not MCS or Computing Service
• Search: search for files, folders, programs etc.
• Log off: log out from the MCS

## Basic tasks on a MCS PC

Full lists of MCS applications are available. Most PC applications are stored centrally, in a directory called " Programs". Within this directory they are stored in groups according to function, e.g. word processors, statistical programs, and so on. A few applications are kept on the local hard disks of individual machines (usually for licensing or technical reasons).

The easiest way to start an application is usually to click on the Start button at the bottom lefthand corner of the screen and then on Programs. Double-click on the folder for the group of applications you want, and then on the program you wish to run.

It is also possible to double-click on a file produced by the application (e.g. double-clicking on an Excel file will launch Excel if it is not already running), but this is not the recommended method on the MCS.

Some useful Windows applications are:

• For web browsing: Internet Explorer, Firefox*
• For email: Hermes Webmail (opens in a browser window), Thunderbird*
• For office applications: Microsoft Office
• For reading Usenet News: Thunderbird*
• For file transfer: WinSCP
• For remote login via SSH: PuTTY

*Note. These programs are found within the Mozilla folder (after clicking Start, All Programs).

When you have finished, it is important that you remember to save your files and log out of the MCS. Failure to do so could result in another user altering, deleting, or reading your files. After 35 minutes of inactivity a warning message will appear on screen. If no unsaved files are open and you do not cancel this message, you will be automatically logged out after a further 5 minutes. If unsaved files are open, you will be given an opportunity to save them before being logged out. You will not be logged out unless unsaved files are saved.

To log out, close all files then click on Start and select the Log off key symbol from the bottom of the list. You will be asked to verify that you want to log out.

## Using an MCS Linux PC

An introductory guide to using Linux on a Managed Cluster Service desktop.

## Introduction

This page is about using Linux on a PC in a Managed Cluster desktop. MCS Linux can also be used by remote login from any system. See also information on using DS-Files in MCS Linux and on printing using DS-Print.

In the instructions below, click means click the index finger button (left-hand button in the default mouse setup) unless otherwise specified.

## Logging in

You will usually find that a PC in a MCS room is already switched on, and displaying a Windows information/start screen. If the screen is blank, move the mouse to wake the display. If the machine is switched off, switch it on and go to step 2, below.

1. Hold down the Ctrl and Alt keys while pressing Delete. A warning message about use of the system is displayed; click on OK. At the Windows login screen click on the triangle at the right-hand side of the the red icon at the bottom right of the screen and, from the pull-down menu, select Restart

2. After some preliminary checks, the system will ask you to select the operating system to start; use the down arrow key to highlight MCS Linux and then press Enter ↵ to confirm your choice. If you wait too long to make your selection, the system will start the default operating system, which for most machines is Windows.

3. A splash screen appears and the system continues to boot into Linux. If the system has to update itself this may take some time, and it may reboot.

6. Your desktop with then load.  A window containing the Message of the Day will appear, after the window manager has completely started, the launcher and a menu bar appear.

Please remember to log out when you have finished. Failure to do so could result in another user reading, altering or deleting your files, or sending emails from your account.

## The desktop

MCS Linux is based on Ubuntu and uses the Unity interface to the GNOME desktop environment. Once you have logged in, the login window shows the Message of the Day, the launcher on the left hand side of the screen and the top menu bar.

Hovering your mouse over an icon will show the application name or a short informative label.

At the left of the top menu bar is the name of the currently active application. Moving the mouse to this will show the menu options for that application. At the far right are a set of information icons; clicking the mouse on each gives the menu for each icon. The icons are for communications, connection information, sound, date and time and, at the far right, the cogwheel icon menu includes access to system settings and log out controls.

## Accessing applications through the menu system

Icons for commonly used applications (Dash HomeHome FolderFirefox and Google Chrome web browsers, the Thunderbird mail client, the LibreOffice suite, the GEdit plain-text editor, Terminal, and Settings) are in the launcher. To start one of these, single-click on the icon using the left mouse button.

To access the other applications in MCS Linux, click on the top icon in the launcher bar (Dash Home).

The window that opens has three icons at the bottom. The left hand one shows you applications and files you have recently used. The centre one gives access to the various applications (this is shown in the screenshot above). The right hand icon shows your folders and any files you have accessed recently.

## Mouse and window operations

The main operations you may want are:

• Mouse buttons: Clicking the right mouse button, for example on a window or on the background, gives a context-sensitive menu.

• Windows: In the top corner of each window are three buttons that can be selected with the left mouse button (). The left button closes the window; the centre icon minimises the window (to the launcher); the right icon will maximise the window (to fill the screen). You can also:

• Click and drag on the border of a window to resize it.

• Click and drag on a window's title bar to move the window around the screen.

## The command line interface

The fundamental application on an MCS Linux system is the command line interface, or shell, because every application that can be launched from the menu system can also be launched from the command line and there are many applications and utilities that only work at the command line. The shell also provides a syntax for combining commands and for running commands only under certain circumstances. If you want to do any automation for processing large numbers of files then you will need to understand the command line. If you are happy with the applications and commands provided by the menu system then you need not worry about it.

There are two ways to launch a window running a shell. You can either click on the Terminal icon in the launcher, or you can select Dash Home  Applications → Unix Shell, then select your preferred terminal type. Either way, you should have a window appear. If you have chosen Terminal using either method the terminal started will look something like this:

Once you see the prompt (sp999@scone:~\$ in the image above) you can start typing commands.

See the instructions in IS 6: Changing/Choosing Passwords. If you have forgotten your password you will need to have it reset. See the FAQ on What should I do if I've forgotten my password or it doesn't work?.

## MCS news

The Message of the Day is sourced from the UIS News service, and displayed at login-time.

## Accessibility aids

The MCS systems are designed to be used by the widest possible audience and the operating systems include features that allow those with special needs to adjust their interface.

### Standard facilities

The built-in accessibility facilities can be accessed from System Settings → Universal Access, and allows control over:

• High-contrast rendering of screen elements;
• Rendering of all text in larger type;
• A screen-reader that describes desktop actions as they occur (toggle using Alt+Windows Key+S);
• Provision of an on-screen keyboard;
• Sticky-, slow-, and bounce-key options;
• Keyboard control of the mouse cursor.

### Customizing the graphical interface

Customization of the colour-scheme used by the desktop is possible using the GNOME Color Chooser (gnome-color-chooser) application.  Though some skill is required to use this tool effectively, it may be useful for those users with visual impairments that find that both the default and high-contrast desktop themes are unsuitable for their needs.

Advanced customization of the visual presentation of the desktop is also available via the CompizConfig Settings Manager (ccsm).  As well as allowing you to load/unload a range of plugins, it also allows many plugin-specific settings and key-bindings to be customized.

Functions that can be enabled include:

• Screen magnifier: causes an area around the mouse-cursor to be enlarged, which can be helpful for users with some types of visual impairment.  Enabling the screen magnifier is a three-stage process:

1. First, you must load the Magnifier plugin by ticking the check-box next to it in the ccsm interface.
2. Second, toggle on the screen magnifier function by typing Windows Key+M.  (As well as enabling the screen magnifier, this will unfortunately also load the "Music" dash; press Esc to close this again.)
3. Finally, hold down Windows Key+SHIFT and scroll up or down on your mouse scroll-wheel to increase or decrease the amount of magnification applied.

By default, only a relatively small window around the mouse cursor will be magnified; the size of this window can be adjusted in the Magnifier plugin's configuration options.

• Negative: allows the colours of an individual window or the whole display to be negated.  This can be helpful for users with some types of visual impairment.

• Dim Inactive: causes windows that are not in focus to be dimmed, so as to minimise unwanted distractions.  Once the plugin is loaded, this effect can be toggled by pressing Windows Key+P. This facility can be helpful for users with ADD and related conditions.

### Further support

We publish general information and advice regarding accessibility issues of many kinds.  We also run the Assistive Technology office, which specialises in providing assistive technology advice, training, and support.

## Applications available on MCS Linux

See the full software list for MCS Linux. Particular applications worth noting are:

### Email

The supported mail clients are ThunderbirdEvolution, and the command-line Alpine.

• To use Alpine type alpine at the command line or, from Dash Home → Applications → Type, select Email & Messaging → Alpine. Alpine is preconfigured to connect to Hermes.

• To use Thunderbird, type thunderbird at the command line or, from Dash Home → Applications → Type, select Email & Messaging → Thunderbird. Thunderbird will not be preconfigured, but has been pre-programmed with the details of the Hermes mail service; it should automatically fill in the right settings if you tell it your username is crsid@cam.ac.uk.  If you require further assistance, have a look at the Thunderbird for Hermes help pages.

• To use Evolution (email, contact management, appointment and task scheduling), type evolution at the command line or, from Dash Home → Applications → Type, select Email & Messaging → Evolution Mail & Calendar. Evolution is not preconfigured so if you wish to use it you will need to configure it; see Mail program settings for Hermes for help.

The Hermes webmail service is available using any browser.

Management of email (e.g. vacation messages, spam filtering) should be done through the webmail interface.

### Web browsers

Firefox is the supported browser and can be started by single-clicking the icon in the panel ().

Google Chrome is also provided — in three different versions.  Most users interested in using Chrome will want to use the stable version, however the beta and unstable versions of Chrome are also supplied, and may be useful for users wanting to experiment with browser features that are not yet finished.

Chromium is also available and can be accessed from Dash Home → Applications → Type, then select it from Web Browsing. The Text-based browsers lynx and w3m are also available; to start these type the program name in a terminal window.

You will need to configure any unsupported browser that you wish to use.

## Logging out

To log out click on the cogwheel item at the right of the menu bar at the top of the screen and choose Log Out. Doing this returns you to the login screen, from which you can login to Linux again or choose to reboot the system, e.g. into Windows. A machine left in this state for roughly 45 minutes will consider itself idle.  By default, idle MCS Linux workstations will reboot themselves into the default operating system on the system; on most machines, this will be Windows.

## Known issues

### Home directories exhibit some unusual behaviour

The network fileserver that hosts home-directories runs Windows.  As a consequence, it does not understand some Unix-specific conventions.  Specifically:

• The file-server does not understand executable-bits.  To work around this issue, all files in your home-directory will be treated as having the executable-bit set. It is not possible to remove the executable bit from any file in your home-directory.

• The Windows file permissions model does not map cleanly onto the Unix user/group/other model.  As a consequence, it is not currently possible for you to grant other users selective access to your personal files using the chmod (or equivalent) command.

### sudo commands will not work

The purpose of the sudo command is to run a specific program with administrative privileges.  Programs run with such privileges are not subject to the normal safety features that prevent modification, damage, or subversion of the operating system.  Therefore, the use of such commands is not allowed; any attempt to use a sudo command will result in a warning.

If you believe that an MCS Linux machine is broken, misconfigured, or lacking some essential functionality, please contact the service desk for support and advice.

### Screen-locking is disabled

As a matter of policy, the ability to lock an MCS Linux desktop has been disabled, in order to avoid cases whereby a user leaves a machine locked for an extended period of time, preventing others from using it.

## Further information

30 Useful Unix Commands, intended for Unix beginners who need a guide to the names and details of commands that are likely to be of use to them.

## Using an MCS Linux remote-access server

An introductory guide to using MCS Linux remote-access servers.

This section is about accessing MCS Linux remote access servers. These allow you to access the DS-Filestore and to run MCS Linux applications remotely from a suitably-configured computer from anywhere on the Internet.

## Using SSH

The remote access servers can be accessed from any computer with a Secure Shell (SSH) client that supports version 2 of the protocol, e.g. OpenSSH on Unix systems such as Linux or Mac OS X, or PuTTY on Windows systems.

There are three remote-login services available:

In each case, you should log in using your UIS username (your CRSid) and your UIS password.  For example, from a Linux or Mac command-line, you would type ssh crsid@linux.ds.cam.ac.uk and follow the on-screen prompts.

### Server SSH keys

SSH connections are intended to be secure against eavesdropping and impersonation.  To ensure this, you need to check that the public key advertised by any server you connect to is authentic.  The first time you connect to an SSH server, you will be prompted to verify that the key being offered is correct.  It is important that you check this key carefully.

If your computer supports the automatic verification of SSHFP DNS records using DNSSEC-bis, then this check will be performed for you automatically when connecting to MCS Linux remote login servers.

SSH keys aren't printed directly; they can be quite long.  Instead, a representative key fingerprint will be shown to you by your SSH client for you to check.  Older clients will show you an MD5 fingerprint; newer systems should show you a SHA256 one, which is technically better.

The MCS Linux remote-login servers have keys with the following fingerprints:

serverRSA key fingerprint
SHA256:w+83CJpNTcr6yzLZ6g67QE90CZ+2euM+v/gBH7gvYnQ
linux.phy.ds.cam.ac.uk MD5:b0:40:f2:98:be:01:a5:20:a0:75:01:b6:6b:d1:af:e2
SHA256:5gNshCs7rXkigyDwUvVvDkQw9tYtSiw7ZshKgT43b8A
linux.cl.ds.cam.ac.uk MD5:50:f5:4b:29:af:67:cb:f5:d5:b7:c6:9b:86:6c:f1:ed
SHA256:EQk7Y9Y37i66zC68cSM5btoeHR18wXwqS2Q4oDWjDO0

If you try to connect to any MCS Linux machine and are presented with a fingerprint different to the one listed above, then your connection is not secure and you must immediately disconnect.

Most SSH clients will remember that you have accepted a key as authentic after being told, so you should only need to check any particular server's key fingerprint once.

It will be necessary from time to time to replace the above keys — for example, to take advantage of improvements in modern cryptography.  Barring an emergency, any such change will be advertised well in advance via the UIS News service and the MCS Message of the Day.

### Using X over SSH

If your computer is running an X server, and your SSH client supports it, then you can also run graphical, as well as console, applications remotely.

• from a Windows system, using an X server, for example ExCeed or Cygwin (see below)
• from a Unix (including MacOS X) system with a local X server running, use ssh -Y linux.ds.cam.ac.uk
(If using -Y fails, then try using -X instead.)

Using graphical applications remotely will require significant bandwidth, so a fast broadband or CUDN connection will be required for effective use. Any program which requires physical access will clearly not work remotely — so no USB devices are available — and applications will not be able to play sounds.

### Notes on using ExCeed and Cygwin

• ExCeed. Recent versions of ExCeed have SSH support as a separate module; for older versions you will need to use ExCeed with PuTTY to provide the SSH connection.
• Cygwin. This includes both OpenSSH and an X server. To install it go to http://cygwin.com/ and select the Install Cygwin link in the left hand menu.
• In the package installation screen make sure to select openssh from Net and xorg-x11-base from X11.
• After install open the "Cygwin Shell" and type startx.
An xterm will pop up; type ssh -Y linux.ds.cam.ac.uk to establish your connection.

## Physics and Computer Laboratory students

The dedicated Physics (linux.phy.ds.cam.ac.uk) and Computer Laboratory (linux.cl.ds.cam.ac.uk) remote-login servers only permit users in their respective departments to log in. If you cannot log in to one of these machines, but you can connect to one of the public servers (linux.ds.cam.ac.uk), then it is probably because you haven't been granted the requisite access rights.

If you think that you should be able to connect to one of the departmental servers, then your course coordinator is the person to contact. If you have access to a departmental server, then you should do your coursework on that server by preference, rather than use one of the public machines.

## Known Issues

These are issues that are known to specifically affect remote-access servers running MCS Linux.  You may also wish to consult the list of known issues that affect all MCS Linux machines, desktops and servers both.

### Logging in using a personal public/private key is not supported

The remote-login server that you are connecting to has no special privileges; it needs to know your password before it can provide access to your DS-Filestore home directory on your behalf.  If you try to connect to a remote-login server with a mechanism other than your password, such as with a public/private keypair, then it may fail.  As a consequence, the use of SSH public-key authentication cannot be supported.

## Thirty Useful Unix Commands

This leaflet contains basic information on thirty of the most frequently used Unix Commands. It is intended for Unix beginners who need a guide to the names and details of commands that are likely to be of use to them.

Every effort has been made to make this leaflet as generally valid as possible, but there are many different versions of Unix available within the University, so if you should find a command option behaving differently on your local machine you should consult the on-line manual page for that command. Some commands have numerous options and there is not enough space to detail them all here, so for fuller information on these commands use the relevant on-line manual page.

The names of commands are printed in bold, and the names of objects operated on by these commands (e.g. files, directories) are printed in teletype.

## Index of Commands

 cat - display or concatenate filescd - change directorychmod - change the permissions on a file or directorycp - copy a filedate - display the current date and timediff - display differences between text filesfile - determine the type of a filefind - find files of a specified name or typeftp - file transfer programgrep - searches files for a specified string or expressiongzip - compress a filehelp - display information about bash builtin commandsinfo - read online documentationkill - kill a processlpr - print out a filels - list names of files in a directoryman - display an on-line manual page mkdir - make a directorymore - scan through a text file page by pagemv - move or rename files or directoriesnice - change the priority at which a job is being runpasswd - change your passwordps - list processespwd - display the name of your current directoryquota - disk quota and usagerm - remove files or directoriesrmdir - remove a directorysort - sort and collate linesssh - secure remote accesstar - create and use archives of files

## cat - display or concatenate files

cat takes a copy of a file and sends it to the standard output (i.e. to be displayed on your terminal, unless redirected elsewhere), so it is generally used either to read files, or to string together copies of several files, writing the output to a new file.

cat ex
displays the contents of the file ex.
cat ex1 ex2 > newex
creates a new file newex containing copies of ex1 and ex2, with the contents of ex2 following the contents of ex1.

## cd - change directory

cd is used to change from one directory to another.

cd dir1
changes directory so that dir1 is your new current directory. dir1 may be either the full pathname of the directory, or its pathname relative to the current directory.
cd
changes directory to your home directory.
cd ..
moves to the parent directory of your current directory.

## chmod - change the permissions on a file or directory

chmod alters the permissions on files and directories using either symbolic or octal numeric codes. The symbolic codes are given here:-

     u  user      +  to add a permission                   r  read
g  group     -  to remove a permission                w  write
o  other     =  to assign a permission explicitly     x  execute (for files),
access (for directories)


The following examples illustrate how these codes are used.

chmod u=rw file1
sets the permissions on the file file1 to give the user read and write permission on file1. No other permissions are altered.
chmod u+x,g+w,o-r file1
alters the permissions on the file file1 to give the user execute permission on file1, to give members of the user's group write permission on the file, and prevent any users not in this group from reading it.
chmod u+w,go-x dir1
gives the user write permission in the directory dir1, and prevents all other users having access to that directory (by using cd. They can still list its contents using ls.)

## cp - copy a file

The command cp is used to make copies of files and directories.

cp file1 file2
copies the contents of the file file1 into a new file called file2cp cannot copy a file onto itself.
cp file3 file4 dir1
creates copies of file3 and file4 (with the same names), within the directory dir1dir1 must already exist for the copying to succeed.
cp -r dir2 dir3
recursively copies the directory dir2, together with its contents and subdirectories, to the directory dir3. If dir3 does not already exist, it is created by cp, and the contents and subdirectories of dir2 are recreated within it. If dir3 does exist, a subdirectory called dir2 is created within it, containing a copy of all the contents of the original dir2.

## date - display the current date and time

date returns information on the current date and time in the format shown below:-
Wed Jan 30 11:27:50 GMT 2008

It is possible to alter the format of the output from date. For example, using the command line
date '+The date is %d/%m/%y, and the time is %H:%M:%S.'

at exactly 11.30am on 30th January 2008, would produce the output
The date is 30/01/08, and the time is 11:30:00.

## diff - display differences between text files

diff file1 file2 reports line-by-line differences between the text files file1 and file2. The default output will contain lines such as n1 a n2,n3 and n4,n5 c n6,n7 , (where n1 a n2,n3 means that file2 has the extra lines n2 to n3 following the line that has the number n1 in file1, and n4,n5 c n6,n7 means that lines n4 to n5 in file1 differ from lines n6 to n7 in file2). After each such line, diff prints the relevant lines from the text files, with < in front of each line from file1 and > in front of each line from file2.

There are several options to diff, including diff -i, which ignores the case of letters when comparing lines, and diff -b, which ignores all trailing blanks.

diff -cn
produces a listing of differences with n lines of context, where the default is three lines. The form of the output is different from that given by diff, with + indicating lines which have been added, - indicating lines which have been removed, and ! indicating lines which have been changed.
diff dir1 dir2
will sort the contents of directories dir1 and dir2 by name, and then run diff on the text files which differ.

## file - determine the type of a file

file tests named files to determine the categories their contents belong to.

file file1
can tell if file1 is, for example, a source program, an executable program or shell script, an empty file, a directory, or a library, but (a warning!) it does sometimes make mistakes.

## find - find files of a specified name or type

find searches for files in a named directory and all its subdirectories.

find . -name '*.f' -print
searches the current directory and all its subdirectories for files ending in .f, and writes their names to the standard output. In some versions of Unix the names of the files will only be written out if the -print option is used.
find /local -name core -user user1 -print
searches the directory /local and its subdirectories for files called core belonging to the user user1 and writes their full file names to the standard output.

## ftp - file transfer program

ftp is an interactive file transfer program. While logged on to one system (described as the local system), ftp is used to logon to another system (described as the remote system) that files are to be transferred to or from. As well as file transfers, it allows the inspection of directory contents on the remote system. There are numerous options and commands associated with ftp, and man ftp will give details of those.

WARNING! When you use ftp the communications between the systems are not encrypted. This means that your password could be snooped if you use it make an ftp connection. If you wish to transfer files between two systems where you have accounts it is better to use the commands sftp (secure file transfer program) or scp (secure remote file copy program) if available, as they provide encrypted file transfer. See the section on ssh for examples.

Some systems offer a service called "anonymous ftp", usually to allow general access to certain archives. To use such a service, enter anonymous instead of your username when you ftp to the system. It is fairly standard practice for the remote system to ask you to give your email address in place of a password. Once you have logged on you will have read access in a limited set of directories, usually within the /pub directory tree. It is good etiquette to follow the guidelines laid down by the administrators of the remote system.

A simple example anonymous ftp session is shown below:-

ftp isccp.giss.nasa.gov
If the connection to the remote system isccp.giss.nasa.gov is established, it will respond with the prompt:-
Name (isccp.giss.nasa.gov:user1)
(supposing user1 is your username on your local system). Enter anonymous and press Return. You will then be asked to enter your email address instead of a password.
After logging in some Unix commands, such as cd and ls, will be available. Other useful commands are:
help
lists the commands available to you while using ftp
get remote1 local1
creates a copy on your local system of the file remote1 from the remote system. On your local system this new file will be called local1. If no name is specified for the file on the local system, it will be given the same name as the file on the remote system.
quit
finishes the ftp session. bye and close can also be used to do this.
See File transfer for more detailed examples of using ftp and other methods of file transfer.

## grep - searches files for a specified string or expression

grep searches for lines containing a specified pattern and, by default, writes them to the standard output.

grep motif1 file1
searches the file file1 for lines containing the pattern motif1. If no file name is given, grep acts on the standard input. grep can also be used to search a string of files, so
grep motif1 file1 file2 ... filen
will search the files file1file2... , filen, for the pattern motif1.
grep motif1 a*
will search all the files in the current directory with names beginning with 'a' for the pattern motif1.
grep -c motif1 file1
will give the number of lines containing motif1 instead of the lines themselves.
grep -v motif1 file1
will write out the lines of file1 that do NOT contain motif1.

## gzip - compress a file

gzip reduces the size of named files, replacing them with files of the same name extended by .gz . The amount of space saved by compression varies.

gzip file1
results in a compressed file called file1.gz, and deletes file1.
gzip -v file2
compresses file2 and gives information, in the format shown below, on the percentage of the file's size that has been saved by compression:-
file2 : Compression 50.26 -- replaced with file2.gz

To restore files to their original state use the command gunzip. If you have a compressed file file2.gz, then

gunzip file2
will replace file2.gz with the uncompressed file file2.

## help - display information about bash builtin commands

help gives access to information about builtin commands in the bash shell. Using help on its own will give a list of the commands it has information about. help followed by the name of one of these commands will give information about that commands. help history, for example, will give details about the bash shell history listings.

## info - read online documentation

info is a hypertext information system. Using the command info on its own will enter the info system, and give a list of the major subjects it has information about. Use the command q to exit info. For example, info bash will give details about the bash shell.

## kill - kill a process

To kill a process using kill requires the process id (PID). This can be found by using ps. Suppose the PID is 3429, then

kill 3429
should kill the process.

## lpr - print out a file

lpr is used to send the contents of a file to a printer. If the printer is a laserwriter, and the file contains PostScript, then the PostScript will be interpreted and the results of that printed out.

lpr -Pprinter1 file1
will send the file file1 to be printed out on the printer printer1. To see the status of the job on the printer queue use
lpq -Pprinter1
for a list of the jobs queued for printing on printer1. (This may not work for remote printers.)

## ls - list names of files in a directory

ls lists the contents of a directory, and can be used to obtain information on the files and directories within it.

ls dir1
lists the names of the files and directories in the directory dir1, (excluding files whose names begin with . ). If no directory is named, ls lists the contents of the current directory.
ls -R dir1
also lists the contents of any subdirectories dir1 contains.
ls -a dir1
will list the contents of dir1, (including files whose names begin with . ).
ls -l file1
gives details of the access permissions for the file file1, its size in kbytes, and the time it was last altered.
ls -l dir1
gives such information on the contents of the directory dir1. To obtain the information on dir1 itself, rather than its contents, use
ls -ld dir1

## man - display an on-line manual page

man displays on-line reference manual pages.

man command1
will display the manual page for command1, e.g man cpman man.
man -k keyword
lists the manual page subjects that have keyword in their headings. This is useful if you do not yet know the name of a command you are seeking information about.
man -Mpath command1
is used to change the set of directories that man searches for manual pages on command1

## mkdir - make a directory

mkdir is used to create new directories. In order to do this you must have write permission in the parent directory of the new directory.

mkdir newdir
will make a new directory called newdir.

mkdir -p can be used to create a new directory, together with any parent directories required.

mkdir -p dir1/dir2/newdir
will create newdir and its parent directories dir1 and dir2, if these do not already exist.

## more - scan through a text file page by page

more displays the contents of a file on a terminal one screenful at a time.

more file1
starts by displaying the beginning of file1. It will scroll up one line every time the return key is pressed, and one screenful every time the space bar is pressed. Type ? for details of the commands available within more. Type q if you wish to quit more before the end of file1 is reached.
more -n file1
will cause n lines of file1 to be displayed in each screenful instead of the default (which is two lines less than the number of lines that will fit into the terminal's screen).

## mv - move or rename files or directories

mv is used to change the name of files or directories, or to move them into other directories.

mv file1 file2
changes the name of a file from file1 to file2 unless dir2 already exists, in which case dir1 will be moved into dir2.
mv dir1 dir2
changes the name of a directory from dir1 to dir2.
mv file1 file2 dir3
moves the files file1 and file2 into the directory dir3.

## nice - change the priority at which a job is being run

nice causes a command to be run at a lower than usual priority. nice can be particularly useful when running a long program that could cause annoyance if it slowed down the execution of other users' commands. An example of the use of nice is

nice gzip file1
which will execute the compression of file1 at a lower priority
If the job you are running is likely to take a significant time, you may wish to run it in the background, i.e. in a subshell. To do this, put an ampersand & after the name of your command or script. For instance,
rm -r mydir &
is a background job that will remove the directory mydir and all its contents.
The command jobs gives details of the status of background processes, and the command fg can be used to bring such a process into the foreground.

Use passwd when you wish to change your password. You will be prompted once for your current password, and twice for your new password. Neither password will be displayed on the screen.

## ps - list processes

ps displays information on processes currently running on your machine. This information includes the process id, the controlling terminal (if there is one), the cpu time used so far, and the name of the command being run.

ps
To obtain full details of all your processes, including those from previous sessions use:-
ps -fu user1
using your own user name in place of user1.

ps is a command whose options vary considerably in different versions of Unix (such as BSD and SystemV). Use man ps for details of all the options available on the machine you are using.

## pwd - display the name of your current directory

The command pwd gives the full pathname of your current directory.

## quota - disk quota and usage

quota gives information on a user's disk space quota and usage.

quota
will only give details of where you have exceeded your disc quota on local disks, whereas
quota -v
will display your quota and usage, whether the quota has been exceeded or not, and includes information on disks mounted from other machines, as well as the local disks.

## rm - remove files or directories

rm is used to remove files. In order to remove a file you must have write permission in its directory, but it is not necessary to have read or write permission on the file itself.

rm file1
will delete the file file1. If you use
rm -i file1
instead, you will be asked if you wish to delete file1, and the file will not be deleted unless you answer y. This is a useful safety check when deleting lots of files.
rm -r dir1
recursively deletes the contents of dir1, its subdirectories, and dir1 itself, and should be used with suitable caution.

## rmdir - remove a directory

rmdir removes named empty directories. If you need to delete a non-empty directory rm -r can be used instead.

rmdir exdir
will remove the empty directory exdir.

## sort - sort and collate lines

The command sort sorts and collates lines in files, sending the results to the standard output. If no file names are given, sort acts on the standard input. By default, sort sorts lines using a character by character comparison, working from left to right, and using the order of the ASCII character set.

sort -d
uses "dictionary order", in which only letters, digits, and white-space characters are considered in the comparisons.
sort -r
reverses the order of the collating sequence.
sort -n
sorts lines according to the arithmetic value of leading numeric strings. Leading blanks are ignored when this option is used, (except in some System V versions of sort, which treat leading blanks as significant. To be certain of ignoring leading blanks use sort -bn instead.).

## ssh - secure remote access

ssh (also known as slogin) is used for logging onto a remote system, and provides secure encrypted communications between the local and remote systems using the SSH protocol. The remote system must be running an SSH server for such connections to be possible. For example,

ssh linux.pwf.cam.ac.uk
initiates a login connection to a MCS Linux server.
You can authenticate access by using your password for the remote system, or you can set up a passphrase to avoid typing the login password directly (see the man page for ssh-keygen for information on how to create these).
If you wish to transfer files over an encrypted connection you can use sftp (secure remote file transfer program) or scp (secure remote file copy program), with authentication being handled as for ssh. For example, you could use sftp to connect to the remote system sftp.pwf.cam.ac.uk:
sftp sftp.pwf.cam.ac.uk
Once you have authenticated access to sftp.pwf.cam.ac.uk, you will be in your home directory on the MCS. You can use the command {\bf cd} to change directories on sftp.pwf.cam.ac.uk and lcd to change directories on your local system; get can be used to transfer files from the remote system, and put to transfer files to the remote system. The command quit will terminate the sftp session.
Alternatively, you could use scp to transfer files. In this example scp is used to transfer a copy of the file file1 in your home directory on the remote system linux.pwf.cam.ac.uk to the current directory on the local system, naming the file newfile1.
scp linux.pwf.cam.ac.uk:file1 newfile1
Similarly, if you wish to copy the local file file2 to the remote system, calling the copy newfile2, you can use the command
scp file2 linux.pwf.cam.ac.uk:newfile2

## tar - create and use archives of files

tar can be used to create and manage an archive of a set of files.

tar cf archive1.tar
creates an archive file called archive1.tar containing the contents of the current directory (and any subdirectories it contains). The c option stands for "create" and the f for "filename".
tar cf archive2.tar mydir
creates an archive file called archive2.tar containing the contents of the directory mydir.
tar tvf archive1.tar
lists the contents of the archive file archive1.tar. The t stands for "list" and the v for "verbose listing".
tar xf archive1.tar
extracts the contents of archive1.tar and copy them into the current directory. The x stands for "extract".
tar xf archive1.tar file2
extracts file2 from archive1.tar (if file2 is in the archive).
tar uf archive1.tar file2
If file2 is not already in the archive it will be added. The u stands for "update". If there is already a file called file2 in the archive, file2 will be appended to the archive if it has a more recent timestamp than the file2 already in the archive. This means the most recent version of file2 will be obtained when file2 is extracted from the archive.

Last updated: February 2008 Last reviewed: October 2011