Back to LUV presentations

Unix file systems - an introduction

Kim Oldfield

About this talk

Basic concepts

Shell Commands

Most commands default to using the current directory.

pwd show the current directory, eg "pwd" may print "/home/kim"
cd change current directory, with no arguments will change to your home directory
ls shows files in current directory
ls foo shows files in directory "foo" or the file "foo"
ls *.html shows files in the current directory ending in .html
ls -l shows details of files
ls -a show all files, including files beginning with "."
tree -d show directory structure
less display a file on screen
man where to find help on any command
mount show all file systems currently mounted, or add a file system to the tree, eg "mount -t vfat /dev/fd0 /floppy
umount un mount a file system, eg "umount /dev/fd0" or "umount /floppy"
id show which groups you belong to
chmod change permissions on files
df -h show the free space on all file systems
du -h show how much disk space each direcotry uses

Special directories

. current directory, eg /home/kim/./ is /home/kim/,
eg ls . is the same as ls
.. parent directory, eg /home/kim/../ is /home,
eg if you are in /home/kim ls .. will show you /home
.abc files beginning with "." are not show by default, use ls -a to see
/ paths starting with / are absolute, and do not depend on the current directory
./foo paths which do not start with / are relative, eg ../foo.py, or subdir/bar.py

Permissions: users and groups

> ls -al
drwxr-xr-x  5 kim   kim    8192 Feb 26 19:34 .
drwxrwsr-x  4 root  staff  4096 Nov 22 11:26 ..
-rw-r--r--  1 kim   kim    6684 Feb 26 19:32 unix-file-system.html
-rwxrwxr-x  1 kim   users  4072 Feb 26 19:32 helloworld

TUUUGGGOOO LL user  group  size date   time  file-name
T Type, "d" is a directory, "-" is a file
UUU Permissions for "user"
GGG Permissions for "group"
OOO Permissions for someone who is not the user of in the group
LL number of hard links to the file

Permissions can be changed using chmod.

File system types

The following file system types are used by mount and fstab.
They are listed in /etc/fstab or can be specified by mount with -t.
ext2 default file system for many Linux distributions
ext3 ext2 + journaling, which means that no fsck is required after a power failure
reiserfs, xfs newer file systems, similar to ext2, but improve on various aspects (journaling, speed, size, efficiency)
iso9660 used by most cdroms
proc special virtual file system, none of the files actually exist, but they are created by the kernel on the fly, eg cat /proc/filesystems contains a list of supported file system types on the current system
devfs virtual file system for devices (see below)
msdos dos file system, with 8.3 file names only
vfat win95, 98, 2K, XP file system, supports long file names
ntfs read-only support for NTFS (as used by NT, 2K, XP)

Devices

selected device files
/dev/null throws away all input
/dev/psaux ps/2 mouse
/dev/hda all of the first IDE disk (master device on first IDE channel) typically this is your hard disk
/dev/hda1 the first partition on /dev/hda
/dev/hda2 the second partition on /dev/hda
/dev/hda5 the extended partition, partitions 6+ are contained within this
/dev/hdb the slave device on the first IDE controller
/dev/hdc the master device on the second IDE controller (typically your CDROM)

Layout

/home user home directories, eg /home/kim
/etc configuration files
/usr applications and data, eg /usr/bin
/var data which changes, eg /var/spool/mail
/dev devices, special files
/lost+found where files are recovered to by fsck after file system corruption. normally empty
/tmp temporary files, often cleared during bootup
/proc system information, eg /proc/cpuinfo
/bin programs required during bootup
/sbin programs required during bootup which would only be run the the superuser (root)

Advanced concepts (if time)

Further reading

Man pages for:

Questions?


Would you like to give a talk?