/dev holds the device files. Many of these files are generated at boot time or on the fly. For example, if you plug in a webcam into your machine after it’s booted, a new device entry will automatically appear here.
/lib stores the essential shared library files and modules for the system. Libraries are files containing code that your applications can use.
Files here are required by the system to boot and run any commands and apps.
On Ubuntu 21.04 /lib is a symlink to /usr/lib.
/tmp is a folder that stores temporary system files. Many apps use this folder to store data when the app is running. They usually delete the temporary data when the app is closed by the user.
/var is the directory that contains files to which the system writes data during the course of its operation.
Among the various subdirectories within /var:
- /var/cache – contains cached data from application programs.
- /var/lib – contains dynamic data libraries and files. snap files are kept in the /var/lib/snapd/ directory.
- /var/lock – contains lock files created by programs to indicate that they are using a particular file or device
- /var/log – contains log files.
- /var/run – contains PIDs and other system information that is valid until the system is booted again.
- /var/spool – contains mail, news and printer queues.
Other important locations:
/root is the home directory of the superuser of the system. You shouldn’t need to access this directory.
/media is a directory where external storage will be automatically mounted when you plug it in and try to access it.
/mnt is not commonly used, although it’s still used to manually mount storage devices and partitions.
/proc is a virtual directory that contains information about your computer.
All articles in this series: