Linux File system Hierarchy
- What are file systems?
- Data structure and behavior that an operating system implements to keep track of files on a disk or partition to organize of files and directories [1].
- Before a disk can be used, it should be formatted with certain file system, which initialized data structures need to be written to the disk.
- Unlike Windows file system (NTFS/FAT), there is only one root in the file system hierarchy of many Unix clones i.e. /, known as root.
- Unlike in Windows, Unix system don’t have the concept of Drives (e.g. C: or D:), so each partition in physical hard disk should be associated or linked with some directories, also know as mounting file system.
- In unix Every think is a file or process. So device can also be represented with file located in /dev directory.
- Directories in Root (/)
- /bin: Essential Command binaries like cp, mv
- /boot: contains files related to boot loader
- /dev: Contains device files
- /lib: Essential shared libraries and kernel modules
- /media: mount point for removable media
- /mnt: Mount point for mounting a file system temporarily
- /opt: Add-on application software packages
- /sbin: Essential system binaries
- /srv Data for services provided by the system (usually found in Suse and Debian system)
- /tmp: temporary files
- /usr secondary hierarchy, most of the application programs are installed in /usr directories
- /var: variable data.
- /proc: virtual files system, which is used to store kernel parameter files temporarily
- Accessing into Linux System
- Two type of logins:
- Virtual Consoles (6 text base terminals available)
- Graphical logins (1 GUI Display manager)
- Requires user name and password (root is a super user or administrator)
- Each user has a home directory
- Switching Terminal:
- Press “Alt+F1 to F6” to access Text mode or virtual terminal in most Linux system.
- Press “Ctrl+Alt+ F1 to F6” from GUI mode to access virtual terminal.
- Press “Alt+F7” to access GUI, (in some Linux system like Fedora, “Alt+F1” will switch to GUI mode. Alternatively, starx command can be typed in console to access GUI screen or “init 5” can be executed in console.
- Switching between users
- A user can switch to another by typing ‘su – <username>’, where – option will reset the OS environment as per setting for switched user <username>. For example, “su – shiba” will switched to user name shiba. However, switching to root user don’t require to provide user’s name (i.e. “su -”).
- Two type of logins:
- Note: in Lab environment where students don’t have their own Linux system can access Linux Virtual Machine with SSH clients like Putty, Xshell and SecureShell etc. for following Lab exercises.
- What is shell
- Shell is a interactive user interface between the user and the kernel to execute program or application in an OS. BASH is one of the most popular shell available in Linux/Unix system.
- Starting with shell
- pwd: prints name of current working directory.
- ls: list files in current directory.
- Using help
- man <command_name>: provides detail manual of particular command (e.g. #man ls)
- <command_name> –help : provides brief command options and parameters. (e.g. #ls –help). Most of the unix command also accesp -h option for help, but in some commands like in ls command. In some commands like ls and du, -h options is provided for human readable content display.
- Info <command_name>: it is an alternative help line for man and –help option.
- Documentation: most of the document available with application are stored in /usr/share/doc directory
- Linux command and configurations based on RHCE certification:
- Linux Note 1 Linux Note 2 Linux Note 3 Linux Note 4 Linux Note 5 Linux Note 6 Linux Note 7
References:
-
Source [1]: http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/c23.html
- Source [2]: RH033 Red Hat Linux Essentials.