TechOverview of Unix file system

 UNIX is a computer operating system – the base software that controls a computer system and its peripherals. Unix operating system was first developed in 1970s, and has been under constant development ever since. Operating system simply means, the suit of programs which make the computer work. More specifically, the word UNIX refers to a family of operating systems that are related to one or both of the original UNIX operating systems – BSD and System V. Examples of modern UNIX operating system include IRIX (from SGI), Solaris (from Sun), Tru64 (from Compaq) and Linux (from the Free Software community).
    UNIX is a family of multitasking, multi-user computer operating system that derive from the original AT&T Unix, at Bell Labs research centre by Ken Thompson, Dennis Ritchie, and others. Initially intended for use inside Bell system, AT&T licensed Unix to outside parties from late 1970s, leading to a variety of both academic and commercial variants of Unix vendors such as the University of California, Barkeley (BSD), Microsoft (Xenix), IBM (AIX) and Sun Microsystems (Solaris).

    Unix Fundamentals:

    Unix has concepts such as Users, Groups, Permissions and Network-Shared Resources (such as files, printers, other computer systems, etc.) built-in to the core of its design. This makes Unix a unique powerful and flexible operating system. Along with this power and flexibility comes some unique concepts that make Unix what it is. These concepts are:

    – Users: In order to make user of Unix system, you must first log in. This requires a user account which consists of:


            This is logged in user’s name and how the user is identified to the system itself and to the other user of the system.


            Along with the username, the password grants access, to user, to the system.

        Default Group:

            When user is created, it is assigned to a default group.

        Contact Info:

            Contact information of user can be stored so that the system administrator and other users can contact you if necessary.

        Home Directory:

            A directory or folder assigned to the user. This grants user access to disk storage. This is where the user will keep his/her files and data.

        Default Shell:

            The program which manages login and command line sessions.

    – Groups: Unix group is a collection of users i.e. a list of usernames. Groups provide a mechanism to assign permissions to a list of users all at once. For instance, group associations are typically based on which research group or area of study a user is affiliated with. Each user can belong to more than one group.

    – Permissions: Everything in Unix is owned by user and a group. One of the example of this would be files, by manipulating permissions, the user who owns the file can define which other users and groups can read or modify that file. This way the user can secure his/her sensitive files or data from others.

    – Shared Resources: Unix is a networked operating environment at its core. As such, nearly everything that one can access on the local system can also be accessed via the network from remote systems. This includes, among other possibilities, editing and sharing files, running software or using printers. Even the content of Unix system’s display can be manipulated remotely.


Unix Operating System:

    Unix operating consists of three parts: the kernel, the shell, and the programs.

    – The Kernel:

         The kernel of Unix is the hub of the operating system. It is considered to be the heart of Unix operating system. It allocates time and memory to programs and handles the file-store and communications in response to system calls.

    – The Shell:

         The shell acts as interface between the user and the kernel. When a user logs in, the login programs check the username and password, and then starts another program called the shell. The shell is command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The command are themselves programs; when they terminate, the shell gives the user another prompt.
          The shell and kernel works together. As an illustration of the way that the shell and the kernel works together, suppose a user types rm myfile (which has the effect of removing file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the Unix prompt % to the user, indicating the it is waiting for further commands.

Unix Processes:

    When a program is started on Unix, it creates what is knows as Process on the system. Every process is assigned a unique serial no called it processID or PID for short. Processes can be created by user, but can only be destroyed by someone with permissions to do so – usually the user that created the process or the system administrator. This ensures that the compute jobs user start on the system will not be distributed by any other user of the system until they complete or the user, who started, decide to stop them themselves.

Unix File System And Directory structure:

    Everything in Unix is either a file or a process. A file is collection of data. They are created by users.
    All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root(written as a slash /). Default directories from Unix are as follows:
    – bin: contains all the commands.
    – sbin: additional command provided by third party software.
    – etc: Configuration files.
    – dev: device files(drivers or driver files).
    – mnt: mountable files like CD ROM or external mountable media.
    – media: contains audio, videos, pictures i.e. contains all media files.
    – opt: optional software installation.
    – tmp: temporary files.
    – lib: library files.
    – home: directory of logged in user
    – var: variable files like log files and application data . Also used for deploying web application.

File permissions in Unix:

    File ownership is an important component of Unix that provides a secure method for storing files. Every file in Unix file system has:

    Owner permissions: The owner’s permissions determine what actions the owner of the file can perform on the file.

    Group permissions: The group’s permissions determines what actions a user, who is a member of the group that file belongs to, can perform on the file.

    Other(world) permissions: The permissions for the other indicates what action all other users can perform on the file.


File and directory access modes: The basic building blocks of Unix permissions are the readwrite and execute permissions:

    For Files:

         Read: grants the capability to read i.e. view the contents of file.
         Write: grants the capability to modify or remove the contents of the file.
         Execute: User with execute permissions can run a file as a program.

For Directories:

         Read: User can read the content of the directory. The user can look at the filenames inside the directory.
         Write: User can add or delete the files from the directory.
         Execute: Executing a directory doesn’t really make sense, so think of this as a traverse permission.
    Read, Write and Execute permissions are indicated by r, w and x.
    To check the permission of the file from a particular directory, use command ls -l. This command gives the output as follows:
$ls -l /home/amrood
-rwxr-xr--  1 amrood   users 1024  Nov 2 00:10  myfile
drwxr-xr--- 1 amrood   users 1024  Nov 2 00:10  mydir
    Here the first column represents the permissions of the file. These permissions are broker into threes and each position in a group denotes a specific permission in the order: read(r), write(w), execute(x):
    – The first three characters (2-4) represent the permissions for the file’s owner. For example, -rwxr-xr– represents that the owner has read(r), write(w) and execute(x) .
    – The second three characters (5-7) consists of the permissions for the group to which the file belongs. For example, -rwxr-xr– represents that the group has read(r) and execute(x) permission, but no write permission.


    – The last group of three characters (8-10) represents the permissions for everyone else. For example, -rwxr-xr– represents that there is read only permission.