- 1. Linux Filesystem Hierarchy08/09/2012The Linux Documentation Project
- 2. The Root Directory /bin
- 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 3
- 4. 1. /bin …(cont)cat
- 5. 1. /bin detailcat
falseUtility 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, unsuccessfully5
- 6. 1. /bin detail (cont)hostname
psUtility 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 status6
- 7. 1. /bin detail (cont)pwd
unameUtility 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 information7
- 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)8
- 9. 2. /boot … detail/boot/boot.0300
…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 kernel9
- 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 10
- 11. 3. /dev … detail/dev/ttyS0
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
The partition on primary hdd 11
- 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 12
- 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 13
- 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
192.168.0.99 debian.localdomain.com debian
- 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 Space15
- 16. 6. /libContains 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 16
- 17. 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.17
- 18. 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 location18
- 19. 9. /media Contains subdirectories which are used as mount points for removeable media such as floppy disks, cdroms and zip disks 19
- 20. 10. /mntThis 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
- 21. 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" 21
- 22. 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.22
- 23. 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. 23
- 24. 14. /sbinLike /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. 24
- 25. 14. /sbin … detailshutdown
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)25
- 26. 14. /sbin … detailinit
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)26
- 27. 15. /usrThe 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.27
- 28. 16. /varContains 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 28