Introduction to File Systems
What is a File System?
A file system is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one large body of data with no way to tell where one piece of data stops and the next begins. By separating the data into pieces and giving each piece a name, the data is easily isolated and identified. Taking its name from the way paper-based information systems are named, each group of data is called a "file." The structure and logic rules used to manage the groups of information and their names is called a "file system."
Types of File Systems
There are several types of file systems, each with different features and use cases. Some common file systems include:
- FAT (File Allocation Table): Used in older systems and removable flash drives.
- NTFS (New Technology File System): Used in Windows operating systems.
- ext (Extended File System): Used in Linux operating systems.
- HFS+ (Hierarchical File System Plus): Used in macOS.
File System Hierarchy in Linux
In Linux, the file system hierarchy starts from the root directory, denoted by a forward slash (/). All other files and directories are placed under the root directory. Here is a brief overview of some important directories in the Linux file system:
- /bin: Contains essential binary executables.
- /etc: Contains configuration files.
- /home: Contains user home directories.
- /var: Contains variable data like logs and databases.
- /usr: Contains user programs and data.
Basic Commands to Navigate File Systems in Linux
Here are some fundamental commands to navigate and manage files in a Linux file system:
Lists the files and directories in the current directory.
$ ls Desktop Documents Downloads
Changes the current directory.
$ cd Documents
Prints the current directory path.
$ pwd /home/username/Documents
Creates a new directory.
$ mkdir new_directory
Removes a file or directory.
$ rm file.txt