Linux File Structure
\#linux
Tree structure
Linux File Structure Overview
/root [shortcut:~ /]
║
╠══ /etc [configuration files for the system]
╠══ /bin [essential binaries]
╠══ /sbin [essential system binaries for super user (root)]
╠══ /lib [shared code between binaries]
╠══ /usr [user utilities and applications]
║ ║
║ ╠══ /usr/bin [most user commands]
║ ╠══ /usr/include [standard include files for "C" code]
║ ╠══ /usr/lib [obj, bin, lib files for coding & packages]
║ ╠══ /usr/local [local software]
║ ║ ║
║ ║ ╠══ /usr/local/bin
║ ║ ╠══ /usr/local/lib
║ ║ ╠══ /usr/local/man
║ ║ ╠══ /usr/local/sbin
║ ║ ╚══ /usr/local/share
║ ║
║ ╚══ /usr/share [static data sharable accross all architectures]
║ ║
║ ╚══ /usr/share/man [manual pages]
║
╠══ /var [variable data files]
║ ║
║ ╠══ /var/cache [applcation cache data]
║ ╠══ /var/lib [data modified as programmes run]
║ ╠══ /var/lock [lock files to track resources in use]
║ ╠══ /var/log [log files]
║ ╠══ /var/opt [variable data for installed packages]
║ ╠══ /var/tmp [temporary file saved betwwen reboots]
║ ╠══ /var/spool [tasks waiting to be processed]
║ ║
║ ╠══ /var/spool/cron
║ ╠══ /var/spool/cups
║ ╚══ /var/spool/mail
║
╠══ /home [user home directories shortcut:~]
║ ║
║ ╠══ /alice
║ ╚══ /bob
║
╠══ /dev [device files]
║ ║
║ ╚═ /dev/null [null device, aka."bit bucket", like a rubbish bin in real life]
║ [output redirected to `/dev/null` is discarded.]
║ [`/dev/null` can be used for input to provide a stream of null values.]
║
╠══ /boot [static files of the boot loader]
╠══ /tmp [temporary files]
╠══ /opt [add-on software]
╠══ /mnt [mount files for temporary file system]
╚══ /proc [process information]
Symbols in use:
║╠═ ╦╚
Location | Description |
|---|---|
| Current directory |
| Refer to one directory above current directory |
| Root |
| Home |
Command to check file structure
❯ tree
e.g.
suppose I have a folder and I want to see the file structure. ls could only list the file content, but cannot show the hierarchical structure.
❯ ls
launch model package.xml resource setup.cfg setup.py test xacro-robot
❯ tree
.
├── launch
│ └── launch_robot.py
├── model
│ ├── material_color.xacro
│ ├── model.urdf
│ ├── myrobot.urdf
│ └── robot.xacro
├── package.xml
├── resource
│ └── xacro-robot
├── setup.cfg
├── setup.py
├── test
│ ├── test_copyright.py
│ ├── test_flake8.py
│ └── test_pep257.py
└── xacro-robot
└── __init__.py
5 directories, 13 files
Last modified: 12 June 2025