Ubuntu Filesystem

Ubuntu Filesystem #

Ubuntu’s filesystem is structured hierarchically, with the root directory denoted by the forward slash character /. This means that any path starting with / is an absolute path, representing the full path to a file or directory starting from the root directory.

Various types of files and directories are stored at different locations within the hierarchy to maintain an organized and standardized structure.

Important directories #

Here is a brief overview of some important directories in the Linux Ubuntu filesystem:

DirectoryDescription
/The root directory, where the filesystem hierarchy begins. All files and directories are organized under here.
/binContains essential binary executables used by the system and users, such as basic commands like ls, cp, and rm which we’ll see later.
/bootStores the bootloader, kernel, and other files required for the boot process.
/devHolds device files that represent hardware devices and some software components, such as hard drives, terminals, and printers.
/etcContains configuration files for the system and various installed applications.
/homeStores personal files and settings for each user on the system. Each user has a separate subdirectory under here, usually named after their username.
/libContains shared libraries and kernel modules needed by the system and applications to function properly.
/mediaServes as a mounting point for removable media, such as USB drives and CDs.
/optHouses optional software and packages that are not part of the default installation.
/sbinStores system binary executables used for system maintenance, such as fdisk, ifconfig, and reboot.
/tmpContains temporary files created by the system and users. These files are typically deleted after a reboot.
/usrIncludes shareable, read-only data, such as executables, libraries, and documentation.
/varContains variable data files, such as logs, databases, and temporary files generated by running applications.

Notable differences with the Windows filesystem #

While Ubuntu and Windows both use hierarchical filesystems, there are some key differences between them.

  • Directory separators → In Windows, directory separators are backslashes \ while in Ubuntu they are forward slashes /.

  • Drive letters → In Windows, each disk partition or storage device is assigned a drive letter like C: or D:, whereas in Ubuntu, everything is mounted under the root directory. Similarly, the Windows root folder is usually the drive letter where the operating system is installed, often C:\, whereas in Ubuntu, the root directory is always /.

  • File extensions → In Windows, file extensions are used to determine the file type and which application should open the file, while in Ubuntu, the file type is determined by the file’s content and the permissions set on the file.

  • Registry → Windows has a centralized configuration database called the registry, which stores settings and preferences for the system and applications. Ubuntu does not have an equivalent centralized database; instead, configuration files are typically stored in the /etc directory or in the user’s home directory.

  • Symbolic links vs. Shortcuts → Symbolic links in Ubuntu are a powerful feature that allows you to create a reference (or “link”) from one location to another file or directory in the filesystem. When you use a symlink, it behaves just like the actual file or directory it points to, meaning applications and command-line utilities treat it as if it were the original file or directory. In contrast, Windows shortcuts are primarily designed for user convenience in the graphical user interface. They are special files that are not treated the same as the actual file or directory by the system.

On macOS, the filesystem shares many similarities with Linux Ubuntu, especially since both come from Unix. However, one notable difference is the location of the home directory.

In macOS, home directories are located under /Users instead of /home. Despite this difference, the overall structure and inner-workings of the filesystem remain largely consistent between the two operating systems.