Download - Unix Tut Guide
-
8/13/2019 Unix Tut Guide
1/12
Tutorial Guide
to the IS Unix Service
The aim of this guide is to help people to start using the facilities available on the
Unix and Linux servers managed by Information Services. It refers in particular to the
general purpose Unix servergranby. The information in this Guide is also helpful ifyou are using other Unix/Linux servers.
-
8/13/2019 Unix Tut Guide
2/12
Contents
1. Servers...........................................................................................................1
2. Username and password..............................................................................1
3. Software for connecting to Unix/Linux hosts ............................................1
4. Text-based (command line) interface via SSH ..........................................2
Multiple sessions....................................................................................5
5. Text-based (command line) interface via SSH with Exceed running in
background.................................................................................................5
6. Windows style desktop on granby..............................................................5
Points to note about using the desktop...................................................7
Basic features of the KDE desktop ........................................................7
7. File permissions a brief description.......................................................9
8. Selecting groups of files by pattern matching ...........................................9
9. Transferring files between the server and a PC......................................10
10. Help information......................................................................................10
-
8/13/2019 Unix Tut Guide
3/12
Tutorial Guide to the IS Unix Service 1
1. ServersInformation Services provides a Unix server known as granbyfor general type of
work, a Linux (64 bit) server known ascauntonfor running specialized applications
requiring intensive computing power, and also some Unix workstations in variouslocations. The term Unix Service in this Guide refers to all of these collectively. IS
also provides access to a High Performance Computing (HPC) facility using Linux
servers.
This Guide refers mainly to granby, but much of the information in it is also
applicable to the other servers mentioned above.
You can check the availability of software on the Unix service and the HPC from the
applications web page on the IS website at the link:
www.nottingham.ac.uk/is/services/software/
2. Username and passwordBefore you can use granby, your username must be created on the Unix service.
Students can register to use the Unix service from a PC in an IS Computer Room by
re-entering the registration software and requesting the creation of a username on the
Unix service. Members of staff should contact their School IT Representative.
Having obtained a username and password for the Unix service you may use that
username and password to access granby, caunton and the IS Unix workstations.
After logging in for the first time, using the supplied default password, you must
change your password as soon as possible to something known only to you. The
change of password will be actioned on the all Unix servers and workstations
mentioned above. Note that the Unix command to change your password is: passwd.
Please bear in mind that Unix/Linux servers arecase sensitive.Your username must
be typed in lower case, and each letter of your password must be typed in the correct
case in which it was set.
3. Software for connecting to Unix/Linux hostsOn PCs in IS Computer Rooms, software for connecting to remote hosts is provided
in the NAL folder calledAccessing the Internet. If you are using another PC, such as a
research group or individual staff PC in a School, you should install this software
locally on the PC. For information on how to obtain the installation material, please
consult the entries onSSHand Exceedon the Applications web page whose link has
been given above.Exceedmay be installed from the NAL folder entitledSoftware
Installationor from a CD available from the IT Service Point, while SSHcan be
downloaded can the website www.ssh.com.
When you run this software, it creates an interface on the PC through which youcan communicate with the remote servers. Three types of interfaces are available:
http://www.nottingham.ac.uk/is/services/software/http://www.nottingham.ac.uk/is/services/software/ -
8/13/2019 Unix Tut Guide
4/12
2 Tutorial Guide to the IS Unix Service
A text-based interface viaSSH.The keyboard is used to enter commands and
the remote host returns the results only in text form. The mouse cannot be
used for input to the remote host, and no graphical output can be displayed.
A text-based interface viaSSHbut with the addition ofExceedrunning in the
background. This works as above, but now the host can launch windows todisplay graphical output from programs.
A Windows style desktop viaExceed.This provides a fully-featured graphical
desktop running on granby. Other hosts can be accessed through this desktop.
If you are connecting to a University Unix/Linux server, such as granby, from outside
the University, you may have to use a text-based interface as in the first method
above, since it may be impossible or impractically slow to use graphical displays. A
text-based interface is also preferable for short sessions.
4. Text-based (command line) interface via SSHOn PCs in public access areas, SSH programs can be run from the NAL folder called
Accessing the Internet.The SSH Secure Shellprogram is recommended. (An
alternative isPutty,available in the same NAL folder.)
To connect usingSSH Secure Shell,double-click on the NAL icon which image is
shown below:
A window like the one shown below will be launched:
PressQuick Connectand in the resultingConnect to Remote Hostwindow:
a) Type granby in theHost Namebox (from off-campus you will need to
type the full address granby.nottingham.ac.uk)b) Type your unix username in lower case in theUser Namebox
-
8/13/2019 Unix Tut Guide
5/12
Tutorial Guide to the IS Unix Service 3
c) Press Connect.
d) In the window which appears, enter your password. (To delete what
you have typed, you can use the back space key or highlight your input
with the mouse and press delete.)
(Note:You can also connect to caunton or an HPC clone by typing the appropriate
host name.)
After logging in to granby, you can practise with the following commands in order.
Command: Comments:
pwd Stands for print working directory. Displays path of current directory.Initially will show home directory path:/home/username
ls Lists the contents of your current directory. Initially it will be empty.
pico This starts the text editorpico. Use this to create a file in your homedirectory, called, say, beeston.txt
ls After creating and saving a file, try thels command again.
ls -l This is an example of anoptionwith acommand.Theloption of thelscommand produces a long list with more information about each file.
mkdir Stands for make directory. Creates a new directory. For example:
mkdir green
creates a directory calledgreenin the current directory. This is anexample of aparameter(green) with a command (mkdir).
lsandls -l Now with a file and a directory in the home directory, try the commands
lsandls -l.
cd Stands for change directory. Changes the current working directory.For example:
cd green
makesgreenthe current working directory.
pwd Now try the pwd command and the output will be of the form:/home/username/green
cd To change back to the home directory, use the command:
cd ..The .. (two dots) stands for the parent directory and this commandchanges to the directory containing the current directory.Note that the commandcd without any parameter always changes to thehome directory.
cp Stands for copy. It takes two parameters and copies an existing fileinto another one. For example:
cp beeston.txt dunkirk
will create a file called dunkirk with the contents of the file beeston.txt.(If a file with the name dunkirk already existed, it would be replaced by
the new file.)
If the second parameter is a directory, the file is created in that
-
8/13/2019 Unix Tut Guide
6/12
4 Tutorial Guide to the IS Unix Service
directory. Thus:
cp beeston.txt green
will create a file ingreencalled beeston.txt as a copy of the filebeeston.txt in the home directory. The command:
cp beeston.txt green/city.txt
will create a file ingreencalled city.txt as a copy of the file beeston.txtwhich is in the home directory.
ls -l Tryls -lin the home directory.Change to the directory green (using cd).Tryls -lin this directory.Change back to home directory.Tryls in the following form:
ls -l green
This is an example of a command with an option land a parametergreen.
mv Stands for move. It takes two parameters and moves (or renames) a
file to the new name. For example:
mv dunkirk radford
will, in effect, rename the file dunkirk as radford. It can also be used inthe following forms:
mv radford green
which moves the file radford to the directory green with the nameradford. You can give the moved file a different name by issuing thefollowing command:
mv radford green/hyson
This would move the file radford to the directory green and give it thename hyson.
rmandrmdir rmstands for remove. Deletes a file. With option -i it prompts forconfirmation before deleting the file. Thermdircommand deletes adirectory, but only if the directory has been emptied.
ls -ltand ls -ltr Thels command also has an optiontwhich causes the files to be listed
in time order, with the latest appearing first in the list. Adding theoptionrreverses the order of the list. To see the effect, first create twofiles in this order:
cp beeston.txt a1
cp beeston.txt z9Now try the following three commands and check the order of the list:
ls -lls -ltls -ltr
passwd This is used to change your password. The password must be at least 6characters long and in addition to alphanumeric characters also containat least one non-alphanumeric character.
logout This is used to end your session. You can also pressctrl-d.
You can also end your session by doingdisconnectin SSH. This is found in the Filemenu as well as on a button on the toolbar.
-
8/13/2019 Unix Tut Guide
7/12
Tutorial Guide to the IS Unix Service 5
Multiple sessions
Within anSSHsession to a host, you can launch another session to the same host by
selectingWindowfrom the top menu bar and then selectingNew Terminal. There is
also an icon for it in the toolbar.
With two sessions, you could, for example, view the contents of two different
directories in different windows.
5. Text-based (command line) interface via SSH withExceed running in backgroundIn addition to logging in via SSHas above, launchExceed for SSH.This
icon is in the same NAL folder (Accessing the Internet). When it is
running, all you will notice is the presence of the Exceed tab in the
Windows Task Bar.
Now issue the command xclock.An X window will open, displaying a clock showing
the current time. The following actions can be performed on this window using the
mouse: moving, resizing, minimizing, maximizing, and closing.
The following are some commands which run graphical applications or utilities on
granby that you can issue and see the effect:
maple -cw a mathematical application
nedit an editor for text files
bluefish an editor for html files
kview viewer for graphical images
firefox a World Wide Web browser
To close Exceed, right-click on the Exceed tab in the Windows Taskbar and select
close.
6. Windows style desktop on granbyFor this you need to launchExceed for host loginfrom its icon in the
Accessing the Internetfolder.
After starting it, proceed as follows:
1. On the screen headedXDMCP Display Manager Chooser,select granby byeither double-clicking on it or left-click on it and press theOKbutton. This
screen looks as below (although you will see some other host names as well as
granby):
-
8/13/2019 Unix Tut Guide
8/12
6 Tutorial Guide to the IS Unix Service
2. Then the following welcome screen appears, in which you type your username
and clickOK(or pressEnter):
3. On the next welcome screen,before typing your password,you must first
select theKDE 3desktop. This is done as follows:
a) Press and hold theOptionsbutton to display the drop-down menu.
b) Bring the mouse pointer down to Session.
c) In the right-hand menu that appears, click onKDE 3.
d) Now make sure that the KDE 3 logo has appeared in the box on the
right of the login window.
You will see the screen shown above as you perform the last step in selecting
the KDE 3 desktop.
Note that selecting the KDE 3 desktop is only necessary the first time a
username logs in. On subsequent logins under that username, KDE 3 will beselected by default.
After this, type your password and clickOK(or pressEnter).
2. When you launch this desktopfor the first time:
a) TheWelcome to KDE 3screen appears. We suggest that you selectSkip
Wizardon it, and then Quit and Keepon the next screen in order to close
this wizard.
b) After the desktop launches, two further information windows are
displayed. You can close these as well.
c) Now you are looking at the desktop. The black background is printed with
guidance on how you can change the wallpaper to something you like.
-
8/13/2019 Unix Tut Guide
9/12
Tutorial Guide to the IS Unix Service 7
Points to note about using the desktop
In this desktop only asingle left clickon the mouse is required to launch or
open an item (rather than a double click).
There may be a delay before there is any response to a left-click because you
are communicating with a remote host.
Using aright clickat any point, you can display a drop-down menu of
available actions.
Basic features of the KDE desktop
The Panel:This is the bar across the bottom of the desktop, with various buttons on
it, as shown below.
View of left side of panel:
K Application Control Home Xterm Desktops
Starter Centre
K Application Starter button: This displays a pull-up menu whose items have
further sub-menus. Everything you can do in the desktop is contained within these
menus. The other buttons are short cuts to commonly required actions.
Control Centre button:Launches the Control Centre which is used to customize the
desktop. Practise with changing the wallpaper as follows through the Control Centre:
1. Expand Look & Feel.
2. Under it, click Background.
3. Select Wallpaper tab.
4. Click the down-arrow in the line beginning Wallpaper. A list of image
filenames is displayed.
5. Take the mouse pointer to any filename and the corresponding image will be
displayed in a box above it (which looks like a monitor screen).
6. Click on the desired filename to select it.
7. Press theApplybutton at the bottom to apply the wallpaper.
With the Control Centre still open, practise with the window controls of moving,
resizing, minimizing and maximizing this window.
XTerm button:Launches a text-mode window, similar to the text-based interface
you used earlier, in which you can issue Unix commands. If you issue a command to
run a graphical application or utility, a window will open displaying the graphicaloutput, in which you can use graphical features.
-
8/13/2019 Unix Tut Guide
10/12
8 Tutorial Guide to the IS Unix Service
You can also connect to other servers (e.g. caunton or an HPC clone) from an
XTerm window by using the ssh command, for example:
ssh caunton
Desktops: By default KDE3 creates four desktops. Selecting the buttons labeled 1, 2,
3 or 4 brings up the corresponding desktop. You can vary the number of desktopsavailable by going to:Control Centre > Look&Feel >Desktop and selecting the tab
Number of Desktops.
Home button:This launches a file manager whose appearance is shown below.
Note with the following features:
Locationline shows which folders contents are being displayed.
A tree view of folders is in the left column.
In the main window, files and folders are represented by appropriate icons.
Thisiconicview can be changed to the Detailed Listview by buttons on the
toolbar as well as by the menu selectionView > View Mode.
Files and folders can befiltered,i.e. only those of a certain type displayed, by
going toTools > View Filter.(To see all contents again, selectReset.)
Left-click on a file to view its contents. Note change in the path inLocation.
The up-arrow or the left-arrow in the toolbar can be used to return to theparent folder or the last folder respectively.
Right-click on file to see a drop-down menu of actions on the file (NewWindow to open it in an editing window, rename, delete, copy, etc.)
Left-click on a folder to view its contents.
Right-click on a folder and selectNew Windowto open it in a new file
manager window. Now drag and drop files from one window to the other and,
when dropping, selectcopyormovein the destination folder. Files and folderscan also be dragged to the desktop and placed on it as links(short cuts).
-
8/13/2019 Unix Tut Guide
11/12
Tutorial Guide to the IS Unix Service 9
Right-click in the background of the contents window to display a drop-down
menu to select an action (e.g.Create Newto create folder or file).
Panel: Buttons on the panel can be removed or moved by right-clicking on a button
and selecting the appropriate action. The Panel can be configured by, for example,
adding buttons for other applications. To do this, either right-click on an empty part ofthe Panel or press the Kbutton and select Configure Panelin the pull-up menu.
To log out from Exceed, press theKbutton and select the bottom item in the pull-up
menu calledlogout.There is also a button for it towards the right hand end of the
Panel. Do not simply close the Exceed application in Windows XP.
7. File permissions a brief descriptionThere are 3 types of permission of access to files and directories:
r(for read): allows file and directory contents to be listed.
w(for write): allows file to be edited and deleted.
x(for execute): applies to script files and other executable files and to
directories.
There are 4 categories of user:
user The user you are logged in as.
group all usernames having the same first two letters or a special group.
other everyone else.
all everyone.
Each category can be assigned any combination ofrwx permissions. Permissions on
files can be seen by issuing the commandls -land looking at the set of characters in
the first column. They are also displayed in theHomefile manager if the Detailed List
view is selected.
If you want files within a directory under your username to be readable by others,
then you must give the directoryxand raccess as well asraccess to the files.
If you are managing webpages then all files that you wish to be accessible to people
from a web browser must be made readable to the category ofother.
The unix command to change permissions on files and directories is:chmod
8. Selecting groups of files by pattern matchingWhen specifying names of files and folders in commands, the name can be specified
as apatternrather than one exact name. The command will then act on all files and
folders whose namesmatch that pattern. The * character is used in a pattern to stand
for any character. For example:
b*matches all names beginning withb
*.txtmatches all names ending in.txt
pic*.jpgmatches all names beginning withpic followed by any characters, or
no character, followed by.jpg
-
8/13/2019 Unix Tut Guide
12/12
10 Tutorial Guide to the IS Unix Service
Theechocommand can be used to list the names that match a pattern. For example:
echo *.txt
A pattern can be used for names when issuing commands as in the examples below:
cp *.txt greencopies all *.txt files from current folder to the foldergreen rm bc*deletes all files in current folder whose names begin with bc
chmod a=r *sets read permission for everyone on all files in current
directory.
9. Transferring files between the server and a PCThere are severalFTPprograms available for transferring files between a Unix host
and a PC which are available in the NAL folderAccessing the Internet.Here we look
atSSH FTP Client.This can be launched independently or from withinSSH Secure
Shellwhile logged in to the host.The interface is also very similar to Secure Shell. If
launched independently, you need to connect to the Unix host by doing QuickConnect(similar to logging in through Secure Shell).
After connecting, you will see two windows side by side. The left shows the files and
folders on thelocalsystem (the PC) and the right shows the same on the remote
system (the Unix host) in your home directories on each system. If FTP is launched
from within Secure Shell when you are already logged in to the Unix host, then you
see these two windows without needing to login. In both windows you can navigate in
the filestore to display thesourcefolder (from which you want to copy files or
folders) in one window and thedestinationfolder (to which you wish to copy) in the
other window. Then you can drag files and folders from the source to the destination.
10. Help informationThemancommand (standing formanual) can be used to display pages of information,
known asman entries, about particular commands. For example,
man ls
will display the entry for thels command. The listing of the entry pauses when the
screen becomes full. PressEnterfor the next screenful or pressq to quit. In theman
entry you can find out from theOptionssection which options are available with that
command and what effect they have. There is anExamplessection near the end of theentry giving some examples of how to use the command.
To use themancommand you have to know the name of the command about which
you require information. If you want to find out the name of the command that
performs a certain action (e.g. delete a file), there is a command available on granby
calledhowto. For example, the commands:
howto delete
howto copy
will, in each case, list names of Unix commands that can perform those actions.