Learning

Linux for Starters: Your Guide to Linux – Understanding the File System – Part 12

Last Updated on May 22, 2022

/dev

/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.
Linux for Starters - File System - dev


/lib

/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.
Linux for Starters - File System - lib


/tmp

/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.
Linux for Starters - File System - tmp


/var

/var is the directory that contains files to which the system writes data during the course of its operation.
Linux for Starters - File System - var
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.


Pages in this article:
Page 1 – / and /home
Page 2 – /usr, /bin, /sbin, /snap, /boot, and /etc
Page 3 – /dev, /lib, /tmp, /var, and other locations


All articles in this series:

Linux For Starters: Your Guide to Linux
1What is Linux? Why use Linux? What do I need?
2Choose a Linux distribution meeting your specific needs and requirements.
3Make a bootable Ubuntu USB stick in Windows.
4We show you how to install Ubuntu 21.04 on your hard disk.
5Things to do after installing Ubuntu.
6Navigating your way around the Desktop.
7Updating the system, install new software.
8Open source replacements for proprietary Windows desktop software.
9Get started with the power and flexibility of the terminal.
10We cover the basics of files and permissions.
11Getting help from your system.
12Learn all about the file system.
13Manipulating files from the shell.
14Maintain your system with these simple tips.
15Managing users on your system.
16Explore different desktops to GNOME 3.
17Gaming on Linux.
18Protect your privacy with this guide.
19Access the Windows desktop from Linux using a remote desktop client.
20Set up a virtual machine running Ubuntu as the host and openSUSE as the guest.
21Wine lets you run Windows programs on Linux without emulation.
22Extend your GNOME desktop with extensions and themes.
XUseful Linux commands.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Ethan "Roomer" James
Ethan "Roomer" James
3 years ago

Thanks. This is a pretty good explanation of the basics of the file system. It’s definitely one of the hardest areas to get your head round coming from a purely Windows background.

RustyN
RustyN
3 years ago

Yes, a good intro I think. Maybe you could do a more detailed walktrough?