Lesson 1: The Linux filesystem¶
Looking at directories from within a Linux terminal can often seem
confusing. But bear in mind that these directories are exactly the same
type of folders that you can see if you use any graphical file browser.
From the root level (/
) there are usually around 20 directories. You
can treat the root directory like any other, e.g. you can list its
contents with ls
:
[learner ~]$ ls /
bin dev etc lib lost+found mnt proc run singularity sys usr
boot environment home lib64 media opt root sbin srv tmp var
Filesystem Terminal Colours¶
You might notice some of these files or directories appearing in different colours. Many Linux shells provide features which will let you display files and directories in different colours to make their purpose clear (much like a GUI would use icons). The typical colours used are as following:
file | directory | executable file | archive file | symbolic link | multimedia file |
Typical Filesystem Directories¶
Directory Purpose
----------------- ---------------------------------------------------------------------------------------
/bin Command binaries that need to be available for all users.
/boot Files used during system boot, e.g., GRUB, Kernel(s) and System memory maps.
/dev Device files such as drivers and interfaces to printers and serial ports.
/etc System-wide configuration files only, no binaries.
/home User's home directories, saved files, personal settings, etc.
/lib and /lib64 32-bit and 64-bit libraries essential for the binaries in /bin and /sbin.
/media Mounting point for removable media such as CD-ROMs and Flash drives.
/mnt Temporary mounted filesystems.
/opt Optional application software packages.
/proc Virtual filesystem providing process and kernel information as files.
/root Home directory of the root user.
/run Runtime information stored by applications and system daemons.
/sbin Essential system binaries.
/tmp Temporary files created by scripts or placed by users.
/usr Read-only user data containing the majority of multi-user utilities and applications.
/var Variable files whose content is expected to continually change.
When you log in to Linux you tend to start your session in your home directory (where personal files are traditionally saved), and this is often inside a directory called 'users' or 'home'.