• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Linux-Ubuntu | Directory Structure (Filesystem Hierarchy)
  1. Directory Structure (Filesystem Hierarchy)
  2. The Root Directory
  3. Directories Paths
  4. Paths starting with a period (.), two periods (..), or a tilde (~)
  5. Using wildcard characters to identify files and directories names (metacharacter wildcards)

  1. Directory Structure (Filesystem Hierarchy)
    The filesystem store information in a hierarchical structure that has the form of a tree.

    The root level of the tree is called the root directory, or virtual directory (represented by a single slash "/").
    The root directory contains all the files and directories from all the devices (physical or mount points) of the system.

    Each directory can have files or other sub-directories within it.

    A file or a directory that has its name beginning with the dot character (".") is by default hidden and is not shown by default in the file manager (it will also be hidden if you use ls command without the option "-a").
  2. The Root Directory

    • /bin: contains user commands (cp, rm, ...)
    • /sbin: contains administrative commands
    • /boot: contains the bootable linux kernel and boot loader configuration files
    • /dev: contains files representing access points to devices
    • /etc: contains administrative configuration files
    • /home: contains users' home directories
    • /lib: contains libraries files
    • /media: mount point for devices
    • /mnt: mount point for devices, disk partitions, remote filesystems
    • /cdrom: mount point for cd-roms
    • /proc: contains files representing system resources
    • /root: root user's directory
    • /run: contains applications' temporaries files
    • /tmp: contains applications' temporaries files
    • /usr: contains users' files (binaries, libraries, settings, documentation, ...)
    • /var: contains applications' files (data, configuration, logs, ...)
  3. Directories Paths
    You can identify a directory or a file by using its absolute path (starts from the root directory).

    You can also use a relative path (relative to the current directory) to identify a directory or a file.

    There are also some special forms to define the path of a directory or a file, by using the characters period or tilde (see below).

    The path can also contains variables that they can be substituted by their values when resolving the path name (for example: $HOME, $PWD).
  4. Paths starting with a period (.), two periods (..), or a tilde (~)
    This directory structure will be used in the examples below:
    • A path starting with a period (.) represents the absolute pathname of the current directory.

    • A path starting with two periods (..) represents the absolute pathname of the parent of the current directory.

    • A path starting with a tilde (~) represents the absolute pathname of the user home directory.

    • A string preceded with a tilde (~) represents the absolute pathname of the user home directory referred by the value of the string.
  5. Using wildcard characters to identify files and directories names (metacharacter wildcards)
    You can use some wildcard characters (metacharacter wildcards) to match part of a file or a directory name.
    • *: match any number of characters.

    • ?: match one occurrence of a character.

    • [...]: define one occurrence, a set, or a range of characters.

    You can also use curly braces ({}) to expand a set of characters to match part of a file or a directory name.


    You can use the exclamation character (!) to exclude a pattern:
© 2025  mtitek