UNIX Lecture 1


UNIXª

An introduction to using it

Quintin Cutts M101 x5619

Kernel & Shell

Kernel contains code that runs the machine
disk controllers, screen drivers, file system code, process scheduler
Shell is an interface for the user to this code

Shell as a Working Environment

Compare with Mac Finder
Text-based
Multi-user - one Shell per user
Environment can be personalised
Text-based & graphics-based interfaces each have advantages
Looking at C-shell here
cf Bourne, Korn,BASH shells
Just different varieties of text-based interfaces

Aims and Objectives

UNIX interface typifies a style of OS interface
Aim: gain understanding of such an interface

Objectives
Text-based working environment. Contrast with MacOS. Multi-user environment
UNIX file system, command structure, processes & pipes. Non WYSIWYG editors
Logging on. Navigation around file system. Command construction. Creation, editing and viewing of files. File protections. Getting help. Handling processes, pipes. Redirecting I/O. Personalising working environment. Mail & News. Shell programming
UNIX stamp in CV

Books

UNIX in a Nutshell
Daniel Gilly et al. ISBN 1-56592-001-5 £7.50
UNIX System V - A Practical Guide
Mark Sobell ISBN 0-8053-7566-X £20+

The UNIX File System

UNIX entirely based around the file system
Code for ALL commands and tools are in individual files
Connections to the outside world are represented as files
Consists of hierarchical directories (cf Mac folders)
Every file and folder has a filename
Multi-user environment - access to files can be restricted (permissions)
Certain known points in hierarchy
root, usersÕ home directory, the current working directory

Home Directories

Each user has one
Local root of personal files, tools etc
Contains files specifying how to personalise environment
By default, access by other users restricted
named using userÕs username

The Current Working Directory (CWD)

cf the selected window (folder) in Mac Finder
By default, commands operate over files in this directory
Commands to change the CWD
move to in handout means change the CWD to

Issuing UNIX Commands

Interacting with the Shell involves typing in commands
Commands may be
applications - that take you away from Shell
short utilities that return to Shell immediately
Command structure
command [arg1] [arg2] ..... [argN]

e.g. ls -l fred bert

number of args can be variable
options adjust behaviour of command

Syntax for Denoting Files

Many commands operate over files
need a syntax for identifying files. c/f mini-finder on Mac
syntax defines individual nodes or leaves in file hierarchy
Files/directories denoted using names
By default, denotation begins in CWD
Denoting a file or directory nested within directories
names separated with /
Special symbols at start of denotation define known points
CWD = . [full stop]
root of file system = /
current userÕs home directory = ~ [tilda]
another userÕs home directory = ~username
Other
.. [two full stops] means back up one directory

Getting Help - man

On-line help system using command man

man commandName
gives detailed information about the command
function, usage, meaning of options, examples, bugs
man uses more command to display information on screen
pressing return scrolls information line by line
pressing space scrolls page by page
man more to find out more
man -k keyword
finds any commands that have keyword in their name/synopsis

Some simple commands

where am I?
pwd displays CWD
moving around the file system
cd newDir eg. cd /users/it/itClass/cuttsq
displaying contents of a directory
ls contents of CWD
ls /users/it/itClass contents of specified directory
ls -l -l option gives more information
copying or moving a file
cp f1 f2 copies file specified by f1 to f2
mv f1 f2 moves file specified by f1 to f2