Introduction to file system in Linux

What is a file system?

A file system is a structure that an operating system uses to organize and manage files on a storage device. It defines how data is stored, accessed, and organized on the storage device.

  • System configuration file = Folder A
  • User Files = Folder B
  • Log Files = Folder C
  • Commands and so on = Folder D

Linux also offers various file systems upon installation:

1) ext (Extended File System)
2) ext2
3) Xiafs
4) ext3
5) JFS (Journaled File System)
6) ReiserFS
7) XFS
8) SquashFS

The three major Linux file systems are ext2, ext3, and ext4. Ext4 is the most widely used and default file system for many Linux distributions. It has various improvements over Ext3, including:

  • Better performance
  • Increased file size limits
  • Faster file system checks
  • Known for its robustness
  • Journaling capabilities
  • Backward compatibility with Ext2 and Ext3

File system structure in Linux are as follows:

  • /boot -> Contains file that is used by the boot loader(grub.cfg).
  • /root -> Root user home directory. It is not same as /.
  • /dev -> System device files(webcam, keyboard, mouse, etc).
  • /etc –> System configuration stored here ex: network interfaces, linux user data, etc.
  • /bin -> /usr/bin -> Executables for most essential user commands (how any command executes).
  • /sbin -> /usr/sbin -> essential system binaries program that admin would use(need sudo privilage)
  • /opt -> Third party program installed in this directory.
  • /proc -> Running processes(Only exist in memory).
  • /lib –> /usr/lib -> Essential shared libraries that executables from /sbin.
    strace -e open pwd
  • /tmp -> Temporary resources required for some process kept here temporarily.
  • /home -> User’s directory.
  • /var -> contains files to which the system writes data during the course of operation(logging).
  • /run -> Systems daemons that start very early (e.g. systemd) to store temporary runtime files like PID files.
  • /mnt -> To mount external file system (e.g. NFS).
  • /media -> For cdrom mounts.

Note: You can get all these folders by logging in as a root user and also get some user level folders by logging in as a user.

Navigating File System:

For Navigating in linux file system, there are few commands:
— cd -> cd stands for change directory. It is the primary command for moving you around the file system.
— pwd -> pwd stands for print working directory. It tells your current location in the linux OS.
— ls -> ls stand for list. It lists all the directories/files within a current working directory.

EC2@instance-id:~$

* EC2: Name of the user
* Instance-id: Computer name
* ~: Home directory
* $: Regular user
* #: Root user

Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here