Environment Linux Quick Start Guide


An introduction to the Linux systems in the Faculty of Environment

The Faculty Linux systems rely heavily on the network. For example, though many core software packages are installed on the local system disk, much of the additional and useful third party software (e.g. Matlab, IDL) is accessed from network file systems. This allows a wide range of software to be easily available to all machines.

All files you create will also, generally, be stored on networked file systems, which allows users to easily move between machines, and still have access to the same software and data.

 

Linux Home directory:

Your home directory is your personal file space, stored on a Faculty file server, accessed via the network, and backed up nightly.

On the Linux systems this directory is where all of your settings, preferences and such get stored (for example, your Firefox profile), and is the directory you will be in by default, when you open a terminal or log in to a machine.

As the home directory is stored on the network, rather than a local machine, user files, preferences and configuration (Firefox settings, shell settings..) follow the user between systems/are the same on all systems.

The home directory can be accessed in different ways, for example, the tilde character (~) and the variable ${HOME} should work from a command line:

 

% echo ${HOME} #- 'echo' (print to screen) the value of the HOME variable
/nfs/foe-fs-00_users/earabc
% ls ${HOME} #- list home directory contents using HOME variable
bin Desktop private public_html
% ls ~ #- list home directory contents using '~'
bin Desktop private public_html

Space in the home directory is restricted by user quotas - you can see your current usage and limits with the quota command (the -s option causes units to be displayed in megabytes/gigabytes, rather than bytes):

 

% quota -s
Disk quotas for user earabc (uid 12345):
Filesystem blocks quota limit grace files quota limit grace
foe-fs-00:/export/users
           98M    2048M 2548M       575   0     0

If you would like to request an increase in your quota, please contact IT support via: https://it.leeds.ac.uk (asking for the request to be assigned to the 'Client Linux Team').

If you access a Windows system in the Faculty, your home directory will appear as the 'Z:' drive.

The Linux home directories can be accessed from Windows systems elsewhere on campus, or from a Windows system connected to the University VPN by manually mapping the drive. This requires knowledge of the server and filesystem. (e.g. from Windows Explorer - Tools -> Map Network Drive -> Folder: \\foe-fs-01.leeds.ac.uk\username).

 

Accessing M: Drive from Linux systems:

Accounts on Faculty Linux systems will have a symbolic link called mdrive in their home directory - this is a link to the "M:" drive storage.

Access to this storage requires a credential which is created upon login to a Linux system, but can expire.

If you see 'Permission Denied' errors, similar to: 

 

% ls mdrive/files
ls: reading directory mdrive/files: Permission denied

You may need to renew the credential, which can be done using the kinit command, which will prompt for your University password:

 

% kinit
Password for earabc@DS.LEEDS.AC.UK: 
%

Note:  For some user accounts, ~/mdrive is a text file containing the command needed to access your M: drive rather than a symbolic link.

 

Useful Commands

Though many applications and functions can be accessed from a graphical desktop environment, a lot of work in Linux is performed from a command line interface.

From a desktop session a terminal window can be opened to access the command line. When using the KDE desktop environment, the program 'konsole' can be used - this can be found in the software menu, or by right-clicking on the desktop:

Linux Konsole Screenshot

These are some of the most commonly used, and useful commands:

 

pwd

Show the path to the current working directory:

% pwd
/nfs/foe-fs-00_users/earabc

 

ls

List files and their properties:

% ls
Documents data00.tar.gz file.txt

To list files with extra information add a -l (long listing).

This shows: file permissions, number of links which point to that file (not particularly important to know about), file owner, file group ownership, file size, and time stamp (last modified):

 

% ls -l
drwxr-xr-x 2 earabc users 68       12 Sep 12:59 Documents
-rw------  1 earabc users 78949381 Nov 17 2012  data00.tar.gz
-rw-r--r-- 1 earabc users 15       12 Sep 13:11 file.txt

List file size in 'human readable' format, using the option -h:

 

% ls -lh
drwxr-xr-x 2 earabc users 68  12 Sep 12:59 Documents
-rw------- 1 earabc users 76M Nov 17 2012  data00.tar.gz
-rw-r--r-- 1 earabc users 15B 12 Sep 13:11 file.txt

 

cd

Change directory:

% cd Documents
% pwd
/nfs/foe-fs-00_users/earabc/Documents

Running cd on its own, with no additional arguments, will take you back to your home directory.

 

mkdir

Make a directory:

% mkdir dir00
% ls -l
drwxr-xr-x 2 earabc users 68B 21 Sep 13:06 dir00

 

cp

Copy a file:

% cp ../file00.txt ./file01.txt
% ls
dir00 file01.txt

Note: Two dots ('..') means the parent directory/up one level, and a single dot ('.') means the current directory.

 

rm

Remove a file:

% rm file00.txt

A directory and it's contents can be removed by adding a '-r' (recursive delete) to the rm command. This should prompt for confirmation for deletion of each file by default. To avoid the confirmation, you can add a '-f' (force delete), but use only with extreme caution!:

 

% rm -fr ./dir00

An empty directory can be removed with rmdir:

% rmdir dir00

 

mv

Move/rename a file:

% ls
file01.txt
% mv file01.txt file00.txt
% ls
file00.txt

 

less

View the contents of a file:

% less file00.txt

You can press 'q' to exit, and use up and down arrows to scroll.

 

man

Many commands have manual pages, which provide detailed information on usage and available options, via the man command. General usage is man _commandname_.

For example, to see all the options available to the ls command:

% man ls

 

Keyboard Shortcuts

There are many different keyboard shortcuts available which may vary depending on which shell you are using, and such.

These are the bare essentials, and should be quite universal:

 

tab key

Pressing the 'tab' key allows file names to be automatically completed.

If you wanted to change to the directory ~/Documents, you should be able to type:

% cd Doc

and press the 'tab' key, to auto complete the directory name.

 

If you wished to run the gfortran compiler, you should be able to tap in:

% gfor

and press 'tab', to have the command name automatically completed.

If there is more than one auto complete option available, you can press 'tab' twice to see the options.

 

ctrl+c

Pressing the 'ctrl' key and the 'c' key simultaneously cancels the current action.

If you had started to type out a long command, but then changed your mind, just press 'ctrl'+'c', to cancel and move on to a fresh line.

 

'up' and 'down' arrows

When working in a terminal, your command history is saved, and you can press the 'up' and 'down' arrows to scroll through previously run commands.

 

Editing Text Files:

If you are a new to using Linux systems, you may be most comfortable starting with a graphical text editor - for example 'kwrite', which can simply be launched with:

% kwrite

There are several command line text editors available, with two of the most popular being vi and emacs.

vi is generally universally available on all Linux systems, and is very powerful, but may take a little while to get used to.

 

To get started, you could try (this will start editing the new file, myNewfile.txt):

vi myNewFile.txt

Once vi has launched, press 'i' to be able to insert text, and 'esc' to exit insert mode/stop editing text.

Navigation around the text file can be done with the arrow keys.

To save the file, press 'esc', and enter:

:w

 

To save and quit, press 'esc', and enter:

:wq

 

To quit without saving:

:q!

If things start to go wrong in vi, the best thing to do is pres 'esc' a few times, and enter :q!, which should allow you to exit, without saving changes.

 

Connecting to Windows

There are several Windows Terminal Servers available in the Faculty, which can be used to access Windows software, from the Linux systems.

To connect, the rdesktop command can be used.

There are many options which can be passed to rdesktop (see man rdesktop), but to get started, this command should do the job:

rdesktop -d ds -f foe-sterm

The '-d ds' sets the name of the University Windows Domain ('ds'), the '-f' selects full screen mode, and 'foe-sterm' is the name of the group of Windows Servers.

Once connected, you can switch in and out of full screen by pressing:

Ctrl+Alt+Enter

You should be able to see your Linux home directory connected as the 'Z:' drive.

Once finished with your Windows session, it is good practice to make sure you log out from the Windows Start Menu, rather than just closing the rdesktop program - As there are several servers, you may be connected to a different server next time, so it's best not to leave programs running in a disconnected session.