Linux File System


Linux core offers support for a large number of file systems. User interface provided is the same no matter the type of file system back. Generally different file names and directories are simple to be used efficiently in command line such as  bin/, var/, usr/, lib. Mac Os uses more clear names
such as /library/, /Applications/, /Users/. Most of Linux distributions offers compatible interface with Filesystem Hierarchy Standard 3. FHS defines the main directories names and the content of it in a Linux distribution such as :


Directory                                                     Description


/ bin /                           binary commands associated with significant executable


/ dev /                          dev / null , dev / hda , dev / random  devices


/ etc /                           configurations files


/home/                         home users directories


/ lib /                            libraries


/ mnt /                          temporary system files


/ proc /                         file system procfs


/ root /                          users home ( root )


/ sbin /                         executable commands that requires privileged user rights


/ usr /                           secondary hierarchy : contains binaries and libraries


/ var /                           variable files (logs, queues, temporary)


/ var / log /                    log files for various applications



Basic commands for interaction with file system are : pwd , is , cd , touch , rm, mkdir , rmdir, cp , mv, link , unlink.


User management

Refers to deleting  or adding new users , displays some general information respectively changing informations about the user. In Unix system user information are retained in the /etc/passwd file.

Each line in this file contains user name , his ID , home , the shell and other information. For safety reasons the hash associated with password file is not found in /etc/passwd/ but in /etc/shadow that may not be accessed by most users. To find information about a user of the system can use the commands ID or finger . Privileged user in a Unix system is the user root with the uid 0 and the home in /root.

Root user (uid 0 user) has rights in the system and may run any command. Changing a user is performed with the command su followed by the password for that user. If user is root then the initial password is not required. Ubuntu system disables root user and recommends using sudo command. This command along with /etc/sudoers/  allows running privileged commands by an unprivileged user.

Changing a user password is performed with the command passwd . Privileged user can change any user password while an unprivileged user can change only his password.

In Debian – based system , adding or deleting a user is done through scripts adduser and deluser.

Advantage and disadvantage of using adduser command is the interactivity. Automation of tasks involves non-interactive commands. You can use the commands useradd , userdel and usermod.



Rights on file systems


Unix systems use a simplified model of association rights on an entry in the filesystem. Every file is owned by a user and a group. There are three categories of users :

– user who owns the file ( user )

– group that owns the file ( group )

– other users  ( others )

Abbreviated three categories are called ugo . Each of the three categories has three possible rights:

– read

– write

– execute

Abbreviated three categories are called rwx . The three rights of each of the above functions have different meanings when they are used over files or directories. Changing rights on a file is accomplished with the command chmod . Command takes effect only if it is run by the user that owns the file. Changing owner and group that owns file is accomplished with the command chown .

This command ( chown ) can be run only by privileged user.




One Response to “ “Linux File System”

  1. bittracker says:

    nice short overview ideal for beginners and students!

Leave a Reply

Your email address will not be published. Required fields are marked *