photo lineviral_1.png

Linux File Organization Hierarchy V2.0

What is a file inwards Linux? What is file scheme inwards Linux? Where are all the configuration files? Where exercise I decease on my downloaded applications? Is at that spot actually a filesystem criterion construction inwards Linux? Well, the higher upward paradigm explains Linux file scheme hierarchy inwards a real elementary too non-complex way. It’s real useful when you’re looking for a configuration file or a binary file. I’ve added roughly explanation too examples below, but that’s TL;DR.

Another number is when you lot got configuration too binary files all over the scheme that creates inconsistency too if you’re a large scheme or fifty-fifty an halt user, it tin compromise your scheme (binary talking amongst onetime lib files etc.) too when you lot exercise security audit of your Linux system, you lot respect it is vulnerable to unlike exploits. So keeping a build clean operating scheme (no affair Windows or Linux) is important.


What is a file inwards Linux?


A elementary description of the UNIX system, too applicable to Linux, is this:


On a UNIX system, everything is a file; if something is non a file, it is a process.


This argument is truthful because at that spot are particular files that are to a greater extent than than simply files (named pipes too sockets, for instance), but to decease on things simple, maxim that everything is a file is an acceptable generalization. Influenza A virus subtype H5N1 Linux system, simply similar UNIX, makes no divergence betwixt a file too a directory, since a directory is simply a file containing names of other files. Programs, services, texts, images, too then forth, are all files. Input too output devices, too mostly all devices, are considered to last files, according to the system.


 Where exercise I decease on my downloaded applications Linux file scheme hierarchy v2.0



  • Version 2.0 – 17-06-2015

    • – Improved: Added championship too version history.

    • – Improved: Added /srv, /media too /proc.

    • – Improved: Updated descriptions to reverberate modern Linux File Systems.

    • – Fixed: Multiple typo’s.

    • – Fixed: Appearance too colour.



  • Version 1.0 – 14-02-2015

    • – Created: Initial diagram.

    • – Note: Discarded lowercase version.




Download Links


Following are ii links for download. If you lot demand this inwards whatever other format, permit me know too I volition travail to create that too upload it somewhere.


Large (PNG) Format – 2480×1755 px – 184KB
Largest (PDF) Format – 9919×7019 px – 1686KB

Note: PDF Format is best for printing too real high inwards quality


Linux file scheme description


In gild to deal all those files inwards an orderly fashion, human being likes to remember of them inwards an ordered tree-like construction on the difficult disk, every bit nosotros know from MS-DOS (Disk Operating System) for instance. The large branches incorporate to a greater extent than branches, too the branches at the halt incorporate the tree’s leaves or normal files. For immediately nosotros volition role this paradigm of the tree, but nosotros volition respect out afterward why this is non a fully accurate image.















































































































































































DirectoryDescription


/


Primary hierarchy source too source directory of the entire file scheme hierarchy.


/bin


Essential command binaries that demand to last available inwards unmarried user mode; for all users, e.g., cat, ls, cp.


/boot


Boot loader files, e.g., kernels, initrd.


/dev


Essential devices, e.g., /dev/null.


/etc


Host-specific system-wide configuration filesThere has been disputation over the pregnant of the mention itself. In early on versions of the UNIX Implementation Document from Bell labs, /etc is referred to every bit the etcetera directory, every bit this directory historically held everything that did non belong elsewhere (however, the FHS restricts /etc to static configuration files too may non incorporate binaries). Since the publication of early on documentation, the directory mention has been re-designated inwards diverse ways. Recent interpretations include backronyms such every bit “Editable Text Configuration” or “Extended Tool Chest”.




/opt




Configuration files for plus packages that are stored inwards /opt/.




/sgml




Configuration files, such every bit catalogs, for software that processes SGML.




/X11




Configuration files for the X Window System, version 11.




/xml




Configuration files, such every bit catalogs, for software that processes XML.


/home


Users’ dwelling identify directories, containing saved files, personal settings, etc.


/lib


Libraries essential for the binaries inwards /bin/ too /sbin/.


/lib<qual>


Alternate format essential libraries. Such directories are optional, but if they exist, they receive got roughly requirements.


/media


Mount points for removable media such every bit CD-ROMs (appeared inwards FHS-2.3).


/mnt


Temporarily mounted filesystems.


/opt


Optional application software packages.


/proc


Virtual filesystem providing procedure too core information every bit files. In Linux, corresponds to a procfs mount.


/root


Home directory for the source user.


/sbin


Essential scheme binaries, e.g., init, ip, mount.


/srv


Site-specific information which are served yesteryear the system.


/tmp


Temporary files (see too /var/tmp). Often non preserved betwixt scheme reboots.


/usr


Secondary hierarchy for read-only user data; contains the bulk of (multi-)user utilities too applications.




/bin




Non-essential command binaries (not needed inwards unmarried user mode); for all users.




/include




Standard include files.




/lib




Libraries for the binaries inwards /usr/bin/ too /usr/sbin/.




/lib<qual>




Alternate format libraries (optional).




/local




Tertiary hierarchy for local data, specific to this host. Typically has farther subdirectories, e.g., bin/, lib/, share/.




/sbin




Non-essential scheme binaries, e.g., daemons for diverse network-services.




/share




Architecture-independent (shared) data.




/src




Source code, e.g., the core source code amongst its header files.




/X11R6




X Window System, Version 11, Release 6.


/var


Variable files—files whose content is expected to continually modify during normal performance of the system—such every bit logs, spool files, too temporary electronic mail files.




/cache




Application cache data. Such information are locally generated every bit a resultant of time-consuming I/O or calculation. The application must last able to regenerate or restore the data. The cached files tin last deleted without loss of data.




/lib




State information. Persistent information modified yesteryear programs every bit they run, e.g., databases, packaging scheme metadata, etc.




/lock




Lock files. Files keeping rail of resources currently inwards use.




/log




Log files. Various logs.




/mail




Users’ mailboxes.




/opt




Variable information from plus packages that are stored inwards /opt/.




/run




Information almost the running scheme since final boot, e.g., currently logged-in users too running daemons.




/spool




Spool for tasks waiting to last processed, e.g., impress queues too outgoing post service queue.






/mail






Deprecated place for users’ mailboxes.




/tmp




Temporary files to last preserved betwixt reboots.

Types of files inwards Linux


Most files are simply files, called regular files; they incorporate normal data, for illustration text files, executable files or programs, input for or output from a computer program too then on.


While it is reasonably rubber to suppose that everything you lot come across on a Linux scheme is a file, at that spot are roughly exceptions.



  • Directories: files that are lists of other files.

  • Special files: the machinery used for input too output. Most particular files are inwards /dev, nosotros volition verbalise over them later.

  • Links: a scheme to brand a file or directory visible inwards multiple parts of the system’s file tree. We volition verbalise almost links inwards detail.

  • (Domain) sockets: a particular file type, similar to TCP/IP sockets, providing inter-process networking protected yesteryear the file system’s access control.

  • Named pipes: human action to a greater extent than or less similar sockets too shape a agency for processes to communicate amongst each other, without using network socket semantics.



File scheme inwards reality


For most users too for most mutual scheme direction tasks, it is plenty to bring that files too directories are ordered inwards a tree-like structure. The computer, however, doesn’t sympathize a thing almost trees or tree-structures.


Every division has its ain file system. By imagining all those file systems together, nosotros tin shape an sentiment of the tree-structure of the entire system, but it is non every bit elementary every bit that. In a file system, a file is represented yesteryear an inode, a variety of series number containing information almost the actual information that makes upward the file: to whom this file belongs, too where is it located on the difficult disk.


Every division has its ain laid of inodes; throughout a scheme amongst multiple partitions, files amongst the same inode number tin exist.


Each inode describes a information construction on the difficult disk, storing the properties of a file, including the physical place of the file data. When a difficult disk is initialized to bring information storage, unremarkably during the initial scheme installation procedure or when adding extra disks to an existing system, a fixed number of inodes per division is created. This number volition last the maximum amount of files, of all types (including directories, particular files, links etc.) that tin be at the same fourth dimension on the partition. We typically count on having 1 inode per 2 to 8 kilobytes of storage.At the fourth dimension a novel file is created, it gets a gratis inode. In that inode is the next information:



  • Owner too grouping possessor of the file.

  • File type (regular, directory, …)

  • Permissions on the file

  • Date too fourth dimension of creation, final read too change.

  • Date too fourth dimension this information has been changed inwards the inode.

  • Number of links to this file (see afterward inwards this chapter).

  • File size

  • An address defining the actual place of the file data.


The alone information non included inwards an inode, is the file mention too directory. These are stored inwards the particular directory files. By comparison file names too inode numbers, the scheme tin brand upward a tree-structure that the user understands. Users tin display inode numbers using the -i pick to ls. The inodes receive got their ain dissever infinite on the disk.


Buat lebih berguna, kongsi:
close