Introduction to UNIX: 
Lecture Three


 
3.1 Objectives
This lecture covers:
3.2 File and Directory Permissions
Permission File Directory
read User can look at the contents of the file User can list the files in the directory
write User can modify the contents of the file User can create new files and remove existing files in the directory
execute User can use the filename as a UNIX command User can change into the directory, but cannot list the files unless (s)he has read permission. User can read files if (s)he has read permission on them.
Fig 3.1: Interpretation of permissions for files and directories
As we have seen in the previous chapter, every file or directory on a UNIX system has three types of permissions, describing what operations can be performed on it by various categories of users. The permissions are read (r), write (w) and execute (x), and the three categories of users are user/owner (u), group (g) and others (o). Because files and directories are different entities, the interpretation of the permissions assigned to each differs slightly, as shown in Fig 3.1.
File and directory permissions can only be modified by their owners, or by the superuser (root), by using the chmod system utility.
3.3 Inspecting File Content
Besides cat there are several other useful utilities for investigating the contents of files: There are also several other useful content inspectors that are non-standard (in terms of availability on UNIX systems) but are nevertheless in widespread use. They are summarised in Fig. 3.2.
 
File type Typical extension Content viewer
Portable Document Format .pdf acroread
Postscript Document .ps ghostview
DVI Document .dvi xdvi
JPEG Image .jpg xv
GIF Image .gif xv
MPEG movie .mpg mpeg_play
WAV sound file .wav realplayer
HTML document .html netscape
Fig 3.2: Other file types and appropriate content viewers.
3.4 Finding Files
There are at least three ways to find files when you don't know their exact location:
3.5 Finding Text in Files
3.6 Sorting files
There are two facilities that are useful for sorting files in UNIX:
3.7 File Compression and Backup
UNIX systems usually support a number of utilities for backing up and compressing files. The most useful are:
3.8 Handling Removable Media (e.g. floppy disks)
UNIX supports tools for accessing removable media such as CDROMs and floppy disks.

(BACK TO COURSE CONTENTS)



© September 2001 William Knottenbelt (wjk@doc.ic.ac.uk)