Professional Documents
Culture Documents
Introduction
The UNIX filestore
Files
From the users point of view, all information on the computer is stored in files Files may contain many kinds of information, including programs, data and documents Like paper files, they have a name (chosen by the user) and some content By convention, the filename suffix suggests the type of content
Example files
Myfile.doc = Microsoft Word Document Myfile.xls = Microsoft Excel Document Myfile.ppt = Microsoft PowerPoint Document Myfile.mdb = Microsoft Access Document Myfile.txt = Text file (Notepad) Myfile.jpg, Me.bmp, Me.gif = Picture or image files Myfile.wav, mp3, wmp = Sound files Myfile.html = HTML web page file Myfile.zip = Zipped or compressed file Myfile.exe = Application file Myfile.log = Log file
Directories
Files are stored in directories (folders) Each directory may contain many files and also other directories By convention, directory names do not usually have suffixes
The filestore
There is a single hierarchical filestore that is shared by all users It is spread over the network, may involve many disks on may different computers and may even be linked to other filestores
29/09/2010
Each user has their own personal area that starts at their home directory There are also common areas for programs, projects and administration The filestore starts at the root directory At any time, as they use the system, a user is in a current directory from which they give commands to access files When they first log on, the current directory is set to their home directory
The filestore
The filestore
(root) staff xxx gtr xxx usr bin itmasters stud ug pg xxx04u CUA etc
xxx02u .profile
Coursework1.txt
29/09/2010
xxx02u .profile
mv pathname1 pathname2 changes the name of pathname1 to be pathname2 (e.g., to move files
if pathname2 already exists, then its previous contents are lost if not, then it is created
Coursework1.txt
Printing
lpr pathname prints files
it goes to your default printer you can specify a printer with the -P flag, for example lpr -Phet fred.ps
do not send text files and program listings to laser printers do not send postscript files to line printers!
Most of these commands have many flags for specifying different options
29/09/2010
Absolute /
/stud /stud/ug /stud/ug/xxx04u ~ ~xxx04u
../../../..
../../.. etc ../..
xxx02u .profile
xxx04u .. CUA
/stud/ug/xxx04u/CUA
Coursework1.txt
Permissions lists
Specify who can do what There are three kinds of who: u the user (owner) g members of the users group o others - anyone else There are three kinds of what: r read w write x execute
type d -
group r---rw-
other r---rw-rwxr--r-Drwxr--r--rw-r--r--rwxr--r--
29/09/2010
execute permission controls whether any files and directories below this point can be accessed at all permissions control whether files can be accessed at all, listed, created and deleted
parent directory
To use a file at all you must have execute permission on all of its parents (otherwise it is as if it doesnt exist)
file
chmod mode pathname is used to alter permissions lists Mode specifies a sequence of changes, each of the form who operation permission
who is u, g or o operation is + (grant) or - (revoke) permission is r, w or x
Examples:
chmod o-r g-r plan.doc chmod u+rwx Admin
Further reading
TSG`s guide for students:
http://support.cs.nott.ac.uk/help/docs/shells/
Using text editors (particularly emacs and vi):
http://support.cs.nott.ac.uk/help/docs/emacs/
Using the X Window system:
http://support.cs.nott.ac.uk/help/docs/xwindow/x-usage
29/09/2010
Summary
The UNIX filestore Pathnames Security and file permissions