View
213
Download
0
Category
Tags:
Preview:
Citation preview
Introduction
Course consists of 2 lectures per week plus 2 lab sessions per week
Assessment will be via exam and coursework
My contact details: Mauro.JASKELIOFF@nottingham.edu.c
n
UST Assessment
Activity % of Overall Mark
Coursework 1 - UNIX Tools
20%
Coursework 2 - UNIX Shell Scripting
20%
Exam: 1.5 hours 60%In addition to this, you will be expected to attend weekly laboratory sessions
Important Information
Lecture notes will be available on the shared folder:
U:\2nd Year Share\Computer Science Courses\Semester Two\UST
Important Information (2)
Labs will start: Thursday 15th March, 10:15-11:15am,
SSB119 Friday 16th February, 10:15-11:15am,
SSB119
Coursework: 20th March → 10th April (to be confirmed) 17th April → 15th May (to be confirmed)
Important Information (3)
Exam New course, so no past papers. Model exam paper with sample
answers will be given
UST Reading List
On-line materialUNIX in a Nutshell, Arnold Robbins,
O’Reilly: might be used as a reference.But the main reference is:
System documentation.Any book on UNIX.I like “The UNIX Programming
Environment” by Kernighan and Pike, but it’s rather outdated (1984!)
Course Outline Introduction to UNIX Useful Commands File System Navigation Text Editing Environment Variables UNIX I/O: pipes and
redirections File processing: grep
and regular expressions
Sed and awk UNIX Bourne shell and
shell scripting Compilers, interpreters,
debuggers Documentation systems Software Engineering
Tools: build management systems and version control systems
Introducing UNIX
•What is UNIX ?
•UNIX Kernel
•UNIX Shell
•Example Commands
•UNIX Filestore - next lecture
What is UNIX?
UNIX is an operating systemAn operating system is the program
that controls all the resources of a computer system - both the hardware and the software
Most importantly, it allows you to make use of the facilities provided by the system. Every computer has an operating system.
Different Flavours of UNIX
Commercial: Sun Solaris, SCO, IRIXOpen source: Linux, FreeBSD, NetBSD
Lots distributions
Cygwin Not a full OS but an implementation of all
the standard tools and system calls of UNIX
MacOS X Underlying operating system is BSD
UNIX KernelAt the core of each UNIX system (and
most operating systems)Loaded in whenever the system is
started upManages the entire resources of the
system, presenting them to you and every other user as a coherent system
You do not need to know about it in order to use a UNIX system, but very important if you are administering one.
UNIX Kernel (2)
Amongst the functions performed by the kernel are: managing the machine's memory and
allocating it to each process. scheduling the work done by the CPU so
that the work of each user is carried out as efficiently as possible.
organising the transfer of data from one part of the machine to another.
enforcing the access permissions that are set on the file system
UNIX ShellThe UNIX command line interface
is called the ‘shell’The shell is a program interpreterThere are many different shells,
for example csh, bash, sh. Usually you will run only one type
of shell in a login session
What is a Command Line Interface?
In Windows you usually do things by selecting something with the mouse and then clicking (GUI), but there is limited command line support
In UNIX, traditionally, you do things by typing in commands, but GUIs are common nowadays.
Command Line Completion
Very useful although not always available (available in bash!)
Start typing command (or file name) and then press tab
The shell will try to automatically finish the word for you If more than one choice, press tab again
and the shell will list the possibilities
Copying and Pasting
In Windows you cut and paste using items in the Edit menu
In UNIX you can also use your mouse Left button (click and drag) to
highlight the text you want to copy Middle button (click) to paste the text
somewhere else
Accessing your Linux account
Use NoMachine
For more info, read document by Paul Dempster (see U drive)
It’s a client-server system, with a twist
X-Windows In a normal client-server system (for example,
an email system) the software on the local host is the client and the software on the remote host is the server.
In a X-Windows system this is reversed. The X-Windows server is on your local
machine. It provides the following services: keyboard input, mouse, procedures for drawing on the screen, etc.
The clients are on the remote host. Client processes running on the remote machine use your X Server to get the input from your keyboard and mouse and to display their output on your screen.
Opening and closing the terminal
To open
the terminal:
You can close it by typing exit or pressing ^D (Ctrl+D)
Shell vs. GUIAdvantages of command line interfaces vs
graphical interfaces: Easy to automate History of commands More productive (once you know what you are
doing) Works well over slow network connections
Disadvantages: More difficult at first (but you get used to it)
Linux at Home
The University’s Linux server is only accessible from within the campus
You might want to try installing Linux on your own PC, but this might not be trivial
A simpler option is to download a “live” distribution (a bootable CD)
UNIX CommandsShells perform user requests and they do this
by accepting commandsDifferent types of shell have different
commands, although the core commands are common
A command consists of one or more words separated by white space
The first word is the command nameSubsequent words (flags and arguments)
give additional information or modify the command
E.g. ls –l /usr
Command EntryA command is only entered when you
press the ENTER (or RETURN) keySpecial key strokes include:
DELETE or back space to delete the last character (also ^H)
^D to delete the next character ^W to delete the last word Alt+U to delete the entire line ^C to kill most commands ^A and ^E to go to the beginning or
end of the line
(^X means press the Control key and X at the same time)
Example UNIX commands (2) The who command displays a list of current users
on the system Information includes usernames, where they are
logged in from and when they logged on
zlizmj pts/7 Mar 5 10:49
zuczpd pts/8 Mar 5 11:20
zlizmj pts/9 Mar 5 11:20
zliybzd pts/10 Jan 2 09:03
zliybzh4 pts/12 Jan 8 12:32
zliychj2 pts/13 Jan 7 13:50
zliyblj5 pts/19 Jan 26 15:46
zlizjc pts/22 Jan 3 14:45 (unix:1031.0)
zuczpd pts/15 Jan 3 12:06 (mb-gx520-030.nottingham.edu.cn)
Example UNIX commands (3) The date command displays the current date and
time:
Mon Oct 9 11:27:07 BST 2000
finger describes the person behind a username, for example,
finger gmh@marian gives:
Login name: gmh In real life: Graham M Hutton
Directory: /staff/gmh Shell: /bin/csh
Last login Thu Sep 16, 1999 on pts/2 from marian
No unread mail
Plan:
Example UNIX Commands -Changing your password
The passwd command changes your password
This is one of the first things that you should do
You are prompted for the old and new passwords (the new one twice)
You cannot change your password from the CS Linux server (passwords are stored on a Windows server)
Other Useful UNIX Commands
man - manual pagesinfo - more extensive documentationgpdf - viewer for PDF filesggv - viewer for postscript fileskonqueror - web browser and shared
folders browserbzip2 - compress a file (reverse bunzip2)
Recommended