There are a number of different computing facilities available at the University of York. Ask yourselves if you have found the following when conducting your research on your local machine?
We have a few different machines to use when have found you are in the above position. For this tutorial we will focus on the Linux machines such as research/teaching servers and Viking. Here will will give you a very brief introduction on how to access these machines.
The research and teaching servers
These servers are also known as the Linux Managed Service or LMS for short. Detailed information on the server specifications can be found here. These machines are Desktops, similar to what you may have at home or in your office but with a large number of CPUs and memory. This means that work that your local machine is struggling with may easily be run on one of these machines. Some caveats
- They are a shared machine which means a number of users may be logged on at the same time
- They get rebooted on the first Tuesday of every month
- They run Linux so you may have to learn a little bit of Linux command line to get started.
- If you are a undergraduate you will only have access to the teaching servers.
Exercise 1 - Logging into the research or teaching servers.
There are different ways to login to the LMS depending on what operating system you are running. We will break down the different options here.
Before You Login
If you have not changed your IT Services password since August 2013 then you must do so before you will be able to login. All user password changes are manage via the My IT Account web page. Click on the Password Management (IDM) link in the Manage Your Password field to change your password. You may be given the option to 'synchronise' your password, please use this if you do not want to change your password. The password change (or synchronisation) may take a few minutes before it is visible to the servers.
Accessing research and teaching servers from off-campus
Access from a Windows desktop
Command-line access using PuTTY
PuTTY is available on all IT Services Managed Windows systems: it is pre-installed on Classroom PCs, on Office PCs you can install it from Run Advertised Programs / Software Center. It appears under "Internet Tools" on the start menu.
On unmanaged PCs you can download the installer from the PuTTY Website
When you run PuTTY for the first time, enter the following settings (teaching0 uses the same settings):
- Add the name "research0.york.ac.uk" to the 'Host Name' field
- Check the 'Connection Type' to SSH
- Type the name "research0" in 'Saved Sessions'
- Click 'Save'
- Expand the 'SSH' tab from the 'Category' list
- Choose 'X11' from 'SSH' list
- Check 'Enable X11 Forwarding'
- Choose 'Session' from 'Category' list
- Click 'Save'
Connecting to Research0
- Start PuTTY
- Select 'research0' from the 'Saved Sessions'
- Click 'Open'
- The first time you connect you will get a security alert showing the fingerprint of the server, labeled as 'ssh-rsa' or 'ssh-ed25519'. Check the fingerprint below for the label shown and click "Yes" to proceed if it matches.
Graphical login using x2go
On unmanaged PCs you can download the installer from the x2go Website You will need to configure the settings as follows (teaching0 uses the same settings):
- If the "New session" panel does not appear, select the menu item "Session | New session..."
- Enter "research0" in the 'Session name' field at the top
- Enter "research0.york.ac.uk" to the 'Server: Host Name' field
- Change the 'Session Type' to XFCE
- All other settings can stay on default.
If you wish to change any settings:
- Cancel any login dialogs
- Click the pull-down on the corner of the panel and select "Session preferences..."
Access from a Mac
Go to 'Finder | Applications | Utilities' and run the Terminal application. Then type the following:
For a graphical login, install and configure the x2go client software as described in the unmanaged Windows section above.
Teaching0 can be accessed in the same manner.
Access from a UNIX server or desktop
To login from a terminal window, type the following from your local device with your university username (abc123):
If you require X forwarding, type:
You will be prompted for your IT Services password.
Accessing teaching0 is done in the same manner.
Navigating the research/teaching servers. Using basic Linux command line to get you started
Once you have successfully logged into the the research or teaching servers it may look very different to what you are use too, particularly if you are use to using windows. Please do not let this put you off. The research computing team have successfully managed to help many people use these computers who have never used Linux command line before. It takes a bit of getting use to but the more you use it the easier and quicker it will become over time.
The shell has been the major interface for the Unix/Linux operating system since it was first conceived. The shell allows interaction with the operating system through a text based interface. The shell provides the user with the following features:
- An easy to use command line interface (CLI)
- Combine existing tools to create new tools
- Input/output redirection
- Wildcard characters for filename abbreviation
- Variables and options for environment customisation
- Ability to write shell functions and programs
- Command-line editing
- Command history (quick access to previous commands)
- Command abbreviations
The user starts the shell by logging into the computer with a userid and password
The last line is a command prompt and it is the means by which the computer is telling you that it is ready to accept a command from you. If you do not see the prompt, the computer is probability still executing the last command you have typed. The user types commands which take the form:
Options to a command are usually proceeded by a '-' or '- -', this differentiates them from the arguments. The following example shows the echo command which prints the arguments and the ls command which take options arguments. The ls command display the users file. There will be more explanation of files and the ls command later.
Exercise 2 - Running commands in the Linux shell
When you see the prompt type the following command. You can also copy and paste the command into your terminal
What happens? The terminal should write out "i love York". The echo command is a small program that takes an input called a string, a series of characters and repeats them to the user.
Now try typing the following command.
What do you see? Something like this?
The ls command lists all of the files in your current directory. A directory is equivalent to a folder. The ls -l command gives you more information about each file or folder such as who is the owner of the file, who can access it, when it was last accessed. You can use most linux commands in a number of ways by adding extra flags. Here for ls -l we added the -l flag. If you need to know more about a command you can use either of the following
The file system is the component of the operating system that organises data into files. These files are organised into directories (similar to folders in Windows OS).
When you have logged in you will be placed in a directory which is called your home-directory. To find the name of the directory use the pwd (print working directory).
Now try running the following commands (e.g after the -bash-4.1$ so the first command is pwd, the output is /home/userfs/e/ejb573) on in the terminal. Your output will be slightly different as it will display your username.
The output of the pwd command, /home/userfs/e/ejb573, is called a pathname, and this specifies the location of the users home directory. The first '/' in the pathname is the root directory. names following the '/' are directory names. Directories within directories are called sub-directories. Path names can also specify the location within the filesystem of files. Only the last name of a pathaname can be a file or directory.
The cd command lets you change your working directory to another location in the file system. cd with no arguments places you back in your home directory. The special directory '..' references the directory above your current directory (known as the parent directory).
Creating, moving and copying files and directories
You can create directories, move or copy files or directories to other locations in the filesystem using the mkdir (make directory) mv (move) and cp (copy) commands.
First lets create a new file and directory
You should now see the files afile and bfile and the directory new-dir. Let's experiment with the afile and new-dir
This example creates a new directory, 'new-dir', We then move the file 'afile' to it and create a copy of 'bfile'. We then move the file 'afile' back to our current working directory. Note the use of the '.' file to reference the current working directory. We can use full or partial pathnames to reference other parts of the file system.
Copying a directory is a little more complicated and the directory may contain files and directories. We use the '-r' command to cp to do this.
In this example we wish to copy the contents of the directory 'tmp/test' into the current directory. cp will not copy a directory. we have to use the '-r' (recursive) option to tell cp to copy all files and directory within the directory.
Deleting files and directories
Please be careful with these commands You can use the rm (remove) command is used to delete files.
To remove a directory and all it's contents use the rm -r (recursive) option to the rm command. To be safe and check the files before you remove them use -ri (recursive and interactive) options.
Editing and displaying the contents of files
- vi and vim
Displaying the contents of files
The commands cat (concatenate files) and more displays the contents of file.
The cat command displays all the test in the users file on the screen. This can prove difficult to read if there are large amounts of text. The more command paginates the text and displays portions of it on the screen. The user can use character command to move through the file:
- SPACE - display the next screen of text
- q - quit displaying the file
- b - skip backwards through he file
- /pattern - search for text in the file
Files and directory permissions
Groups are provided to manage sets of users and control access to fie and directories. All users belong to a default group and may be a member of other groups.
The groups command displays which groups you are a member of. Each file and directory you create will be owned by you and be potentially accessible to a group. In the above example the file 'afile' is owned by 'abs4' and is accessible to the 'csrv' group.
There is a 'special' group sometimes called world, or other, which contains all users of the system.
In the above example the first column of the directory listing shows the permissions of the files. These permissions control who is allowed acces the files and directories. There are three categories of user who can has potential rights to access the files - owner, group, world. The access rights to the files are displayed in the form of a sequence of letters like 'drwxr-xr-x'. The meaning is:
- d - if present this is a directory, otherwise it is a file
- the following 3 letters are in three groups and state the access permissions for the owner, group, world users
- w - the file can be written to
- r - the file can be read
- x - if a file it can be executed, if a directory it can be accessed
- example - drwxr-x--- 5 abs4 csrv 4096 Sep 8 17:01 tmp
- this is a directory
- the owner, abs4, can read, write and access the directory
- members of the group, elecclust, can read and access the directory, they can not creat files in the directory
- all other users do not have any access to the directory
To change file permissions use the chmod command.
The chmod command has the form:
chmod <mode> <file>
mode takes the form of:
- u = user (owner)
- g = group
- o = other (world)
- a = all (user, group, other)
- + add permission
- - remove permission
- = explicitly set permission
- w = can be written to
- r = can be read
- x = can be executed if a file, if a directory it can be accessed
To change the group of a file use the command chgrp <groupname> <filename>.