29
Linux Filesystem Hierarchy 05/11/2005 The Linux Documentation Project

Linux Filesystem Hierarchy

  • Upload
    patty

  • View
    63

  • Download
    3

Embed Size (px)

DESCRIPTION

Linux Filesystem Hierarchy. 05/11/2005. The Linux Documentation Project. /bin /boot /dev /etc /home /initrd /lib /lost+found /media. /mnt /opt /proc /root /sbin /usr /srv /tmp /var. The Root Directory. 1. /bin. - PowerPoint PPT Presentation

Citation preview

Page 1: Linux Filesystem Hierarchy

Linux Filesystem Hierarchy

05/11/2005

The Linux Documentation Project

Page 2: Linux Filesystem Hierarchy

2

The Root Directory

/bin /boot /dev /etc /home /initrd /lib /lost+found /media

/mnt /opt /proc /root /sbin /usr /srv /tmp /var

Page 3: Linux Filesystem Hierarchy

3

1. /bin

Contains several useful commands that are of use to both the system administrator as well as non-privileged users.

Usually contains the shells like bash, csh, etc.... and commonly used commands like cp, mv, rm, cat, ls.

Also contains programs which boot scripts may depend on

There are no (real) subdirectories in /bin

Page 4: Linux Filesystem Hierarchy

4

1. /bin …(cont)

cat chgrp chmod chown cp date dd df dmesg echo false

rm rmdir sed sh stty su sync true umount uname

hostname kill ln login ls mkdir mknod more mount mv ps pwd

Page 5: Linux Filesystem Hierarchy

5

1. /bin detail

cat chgrp chmod chown cp date dd df dmesg echo false

→ Utility to concatenate files to standard output→ Utility to change file group ownership→ Utility to change file access permissions→ Utility to change file owner and group→ Utility to copy files and directories→ Utility to print or set the system data and time→ Utility to convert and copy a file→ Utility to report filesystem disk space usage→ Utility to print or control the kernel message buffer→ Utility to display a line of text→ Utility to do nothing, unsuccessfully

Page 6: Linux Filesystem Hierarchy

6

1. /bin detail (cont)

hostname kill ln login ls mkdir mknod more mount mv ps

→ Utility to show or set the system's host name→ Utility to send signals to processes→ Utility to make links between files→ Utility to begin a session on the system→ Utility to list directory contents→ Utility to make directories→ Utility to make block or character special files→ Utility to page through text→ Utility to mount a filesystem→ Utility to move/rename files→ Utility to report process status

Page 7: Linux Filesystem Hierarchy

7

1. /bin detail (cont)

pwd rm rmdir sed sh stty su sync true umount uname

→ Utility to print name of current working directory→ Utility to remove files or directories→ Utility to remove empty directories→ The `sed' stream editor→ The Bourne command shell→ Utility to change and print terminal line settings→ Utility to change user ID→ Utility to flush filesystem buffers→ Utility to do nothing, successfully→ Utility to unmount file systems→ Utility to print system information

Page 8: Linux Filesystem Hierarchy

8

2. /boot

Contains everything required for the boot process except for configuration files not needed at boot time and the map installer

Stores data that is used before the kernel begins executing user-mode programs

May include the system kernel (under symbolically linked)

Page 9: Linux Filesystem Hierarchy

9

2. /boot … detail

/boot/boot.0300 /boot/boot.b /boot/chain.b /boot/config-kernel-

version /boot/map /boot/vmlinuz /boot/vmlinuz-kernel-

version …

→ Backup master boot record.→ The basic boot sector→ Used to boot non-Linux operating systems→ Installed kernel configuration. A config line

such as: CONFIG_FONT_8x8=y→ The location of the kernel

→ Normally the kernel or symbolic link to the kernel

Page 10: Linux Filesystem Hierarchy

10

3. /dev

Usualy is the location of device files A device and a file both can be read from and written

to. So config a device is same with edit a file. EX: sending data to /dev/ttyS0 that means you are sending data to a communication device, such as a modem.

'block devices' are devices that store or hold data 'character devices' can be thought of as devices that

transmit or transfer data

Page 11: Linux Filesystem Hierarchy

11

3. /dev … detail

/dev/ttyS0 /dev/psaux /dev/lp0 /dev/dsp /dev/usb /dev/sda /dev/scd /dev/cdrom /dev/fd0 /dev/had

→ Device connected to Com1 (Modem, mouse,..) → PS/2 mouse connection → First parallel port → Sound card (digital signal processor)→ USB device nodes. → First SCSI device → First SCSI CD-ROM device→ CD-ROM drive → floppy drive→ The partition on primary hdd

Page 12: Linux Filesystem Hierarchy

12

4. /etc

Contains all system related configuration files

Local file used to control the operation of a program

Those files must be static and cannot be an executable binary

Page 13: Linux Filesystem Hierarchy

13

4. /etc … detail

/etc/X11/ : contains all the configuration files for the X Window System

/etc/X11/XF86Config, /etc/X11/XF86Config-4 : 'X' configuration file

/etc/ftpchroot : List of ftp users that need to be chrooted /etc/ftpaccess : Determines who might get ftp-access to your

machine. /etc/gateways : Lists gateways for 'routed' /etc/group, /etc/passwd. lists the configured user groups and

who belongs to them. /etc/hostname : Contains the hostname of your machine /etc/host.conf : Determines the search order for look-ups

Page 14: Linux Filesystem Hierarchy

14

4. /etc … detail

/etc/hosts : This file is used to define a system name and domain combination with a specific IP address

– 127.0.0.1 localhost ::1 localhost – ip6-localhost ip6-loopback – fe00::0 ip6-localnet – ff00::0 ip6-mcastprefix – ff02::1 ip6-allnodes – ff02::2 ip6-allrouters – ff02::3 ip6-allhosts – 192.168.0.99 debian.localdomain.com debian 192.168.0.1 ws001

Page 15: Linux Filesystem Hierarchy

15

5. /home

The user home directories Accessible only to its owner and the system

administrator Contains the user’s personal configuration

files Quite large to be used as User’s Documents

Space

Page 16: Linux Filesystem Hierarchy

16

6. /initrd

Provides the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root file system and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted.

Initrd is mainly designed to allow system startup to occur in two phases, where the kernel comes up with a minimum set of compiled-in drivers, and where additional modules are loaded from initrd.

Page 17: Linux Filesystem Hierarchy

17

7. /lib

Contains kernel modules and those shared library images (the C programming code library) needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin

Windows equivalent to a shared library would be a DLL (dynamically linked library) file

Page 18: Linux Filesystem Hierarchy

18

7. /lib … detail

/lib/'machine-architecture‘ : Contains platform/architecture dependent libraries.

/lib/iptables : iptables shared library files. /lib/kbd : Contains various keymaps. /lib/modules/'kernel-version‘ : The home of all the kernel modules. The

organisation of files here is reasonably clear so no requires no elaboration. /lib/modules/'kernel-version'/isapnpmap.dep : has details on ISA based

cards, the modules that they require and various other attributes. /lib/modules/'kernel-version'/modules.dep : lists all modules dependencies.

This file can be updated using the depmod command. /lib/modules/'kernel-version'/pcimap : is the PCI equivalent of the

/lib/modules/'kernel-version'/isapnpmap.dep file. /lib/modules/'kernel-version'/usbmap : is the USB equivalent of the

/lib/modules/'kernel-version'/isapnpmap.dep file. /lib/oss : All OSS (Open Sound System) files are installed here by default. /lib/security : PAM library files.

Page 19: Linux Filesystem Hierarchy

19

8. /lost+found

Contains the files which were recovered after an unexpected event, such as a proper shutdown.

Try to move each file back to its original location

Page 20: Linux Filesystem Hierarchy

20

9. /media

Contains subdirectories which are used as mount points for removeable media such as floppy disks, cdroms and zip disks

Page 21: Linux Filesystem Hierarchy

21

10. /mnt

This is a generic mount point under mounted (mount is to make a filesystem available to the system) the filesystems or devices.

When a filesystem no longer needs to be mounted, it can be unmounted with umount

• mount /dev/hda2 /home • umount /dev/hda2

Page 22: Linux Filesystem Hierarchy

22

11. /opt

This directory is reserved for all the software and add-on packages that are not part of the default installation

/opt/'package' C:\Windows\Progam Files\"Program Name"

Page 23: Linux Filesystem Hierarchy

23

12. /proc

Virtual filesystem, runtime system information (e.g. system memory, devices mounted, hardware configuration, etc).

The most of them have a file size of 0 To view, use “cat”. Use “vi” to edit.

Page 24: Linux Filesystem Hierarchy

24

13. /root

The home directory of the System Administrator, 'root'

Why not in '/home'? Because '/home' is often located on a different partition or even on another system and would thus be inaccessible to 'root' when - for some reason - only '/' is mounted.

Page 25: Linux Filesystem Hierarchy

25

14. /sbin

Like /bin bet less important /sbin should contain only binaries essential

for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin.

Page 26: Linux Filesystem Hierarchy

26

14. /sbin … detail

shutdown Fastboot Fasthalt fdisk fsck fsck.*

getty halt ifconfig

→ Command to bring the system down.→ Reboot the system without checking the disks (optional)→ Stop the system without checking the disks (optional)→ Partition table manipulator (optional)→ File system check and repair utility (optional)→ File system check and repair utility for a specific

filesystem (optional)→ The getty program (optional)→ Command to stop the system (optional)→ Configure a network interface (optional)

Page 27: Linux Filesystem Hierarchy

27

14. /sbin … detail

init mkfs mkfs.* mkswap reboot route swapon swapoff update

→ Initial process (optional)→ Command to build a filesystem (optional)→ Command to build a specific filesystem (optional)→ Command to set up a swap area (optional)→ Command to reboot the system (optional)→ IP routing table utility (optional)→ Enable paging and swapping (optional)→ Disable paging and swapping (optional)→ Daemon to periodically flush filesystem buffers

(optional)

Page 28: Linux Filesystem Hierarchy

28

15. /usr

The largest share of data on a system the most important directories in the system

as it contains all the user binaries, their documentation, libraries, header files, etc.... X and its supporting libraries, and User programs like telnet, ftp, etc.... as well, can be found here.

Page 29: Linux Filesystem Hierarchy

29

16. /var

Contains variable data, files and directories the system must be able to write to during operation, like system logging files, mail and printer spool directories, and transient and temporary files