Unix File System - University of the Ryukyus

Download Report

Transcript Unix File System - University of the Ryukyus

Unix File System
How Unix organizes files and how
you can find them.
Unix file system
 Home directory
Where your files live.
You always go there when you log in.
 Working directory
Whatever directory you are currently in.
2
Typical Unix file system
root (/)
bin
classes
cs290
001
dev
csfac
ugrad
users
tmp
st fac
ms
jimd
(all people in this class)
staff
phd
usr
var
spool
mail
(all users’ mail)
etc
Typical Directories
 bin: Software for the shell and most common Unix
commands.
 dev: Short for devices, holds the software necessary to
operate peripherals such as printers and terminals.
 etc: Contains various administrative files such as lists of
user names and passwords.
 usr/users: Contains the home directories of users.
 tmp: A directory used to hold temporary files.
 var: Files that contain information that varies frequently;
most commonly, mail directories.
File and Directory Names
 Valid names can be made up of:
Uppercase letters (A to Z)
Lower case letters (a to z)
Numbers (0 to 9)
period (.), underscore (_), commas (,).
 Should not contain spaces or the following:
& * \ | [ ] { } $ < > ( ) # ? ‘ “ / ; ^ ! ~ %
You should also avoid naming files or directories with Unix
commands.
Absolute Pathnames
 To use a file in Unix, all you need is its name.
 To access a file in another directory, you need to know
its pathname.
 A pathname is an address that shows the file’s position
in the file system.
 Absolute path names give a files location in relation to
the top of the file system structure.
 All absolute path names begin with a /.
 Also called full path names.
 Use the ~ as a shortcut for the full path to a home
directory.
Example Directory Structure
root (/)
bin
dev
etc
home
tmp
jill
jack
continents
Bats
oceans
bandicoot
wombat
var
usr
opossum
marsupials
kangaroo
wombat
Absolute Pathnames
 All absolute path names begin with a /.
 Also called full path names.
 Use the ~ as a shortcut for the full path to a home
directory.
Relative path names
 Usually you are interested in a files location relative to
where you currently are in the system.
 A relative pathnames start at the working directory rather
than the root.
 Use the .. to refer to the parent of the current directory.
Example Directory Structure
root (/)
bin
dev
etc
home
tmp
jill
jack
continents
Bats
oceans
bandicoot
wombat
var
usr
opossum
marsupials
kangaroo
wombat
Reading
 Chapter 6.1 – 6.5
 Manipulating Files and Directories