File Structure inside of Linux

File Structure inside of Linux

January 23, 2023 3 min read 3 views 0 discussions
Table of Contents

    On a Linux system, almost everything is a file, and if it is not a file, then it is a process. Here is a general diagram for file structure in Linux.

    There are certain exceptions in a Linux file system:

    • DirectoriesFiles that are lists of other fles.
    • Special file—The mechanism used for inout and output. /dev are special fles.
    • Links—A system to make fle or directory visible in multiple parts of the systems.
    • Sockets—A special fle type, similar to TCP/IP sockets providing inter-process networking.
    • Pipes—More or less like sockets; they form a way for process to communicate with each other with out using network socket.
    File types in a long list:

    Symbol

    Meaning

    -

    Regular fle

    d

    Directory

    l

    Link

    c

    Special fle

    s

    Socket

    p

    Named pipe

    b

    Block device

     Subdirectories of the root directory:

    In Linux, the file system is organized in a hierarchical structure, with the root directory (/) being the top-level directory. All other files and directories are contained within the root directory.

    Directory

    Content

    /bin

    Common programs, shared by the system, the system administrator, and the users.

    /boot

    The startup fles and the kernel, vmlinuz. In some recent distributions also grub data. Grub is the GRand Unifed Boot loader and is an attempt to get rid of the many different boot-loaders we know today.

    /dev

    Contains references to all the CPU peripheral hardware, which are represented as files with special properties.

    /etc

    Most important system confguration fles are in/etc., this directory contains data similar to those in the Control Panel in Windows

    /home

    Home directories of the common users.

    /initrd

    (on some distributions) Information for booting. Do not remove!

    /lib

    Library fles, includes fles for all kinds of programs needed by the system and the users.

    /lost+found

    Every partition has a lost+found in its upper directory. Files that were saved during failures are here.

    /misc

    For miscellaneous purposes.

    /mnt

    Standard mount point for external file systems, for example, a CD-ROM or a digital camera.

    /net

    Standard mount point for entire remote file systems.

    /opt

    Typically contains extra and third-party software.

    /proc

    A virtual file system containing information about system resources. More information about the meaning of the files in proc is obtained by entering the command man proc in a terminal window. The file proc.txt discusses the virtual file system in detail.

    /root

    The administrative user’s home directory. Mind the difference between /, the root directory and /root, the home directory of the root user.

    /sbin

    Programs for use by the system and the system administrator.

    /tmp

    Temporary space for use by the system, cleaned upon reboot, so don’t use this for saving any work!

    /usr

    Programs, libraries, documentation, etc., for all user-related programs.

    /var

    Storage for all variable files and temporary files created by users, such as log files, the mail queue, the print spooler area, space for temporary storage of files downloaded from the Internet, or to keep an image of a CD before burning it.

    Community Q&A