$linuxjunkies
>

directory

also: folder, dir

A container that holds files and other directories, organized in a hierarchical tree structure. Directories are special files that act as organizational units in the filesystem.

A directory is a filesystem object that stores references to files and other directories. It serves as a folder that organizes and groups related items. The Linux filesystem is structured as an inverted tree, with the root directory / at the top and all other directories branching below it.

Each directory contains entries called inodes that point to files or subdirectories. You can navigate directories using commands like cd, list their contents with ls, and create new directories with mkdir. For example: mkdir /home/user/documents creates a new directory called documents inside /home/user.

Common system directories include /home for user files, /etc for configuration, /var for variable data, and /usr for user programs. A directory's path shows its location in the tree—absolute paths start with / (like /home/user/documents), while relative paths are relative to the current directory (like documents if you're already in /home/user).

Related terms