This series of articles, which explains various concepts and commands in Linux, is aimed at those new to Linux. We take a look at the basics of Linux to gain a better understanding of the power it has.

Linux is a major force in computing technology, powering everything from mobile phones and personal computers to supercomputers and servers. The job of a systems administrator is to manage the operations of a computer system. As most computing devices are powered by Linux, it makes sense to learn it. By the end of this article, you should be able to know and understand:

  • Linux file systems
  • File system hierarchy
  • Linux online manual page
  • Root/super user
  • Handling files and directories

All the commands are demonstrated using a CentOS Linux distro.

The Linux file system

A file system is a method of storing files on a hard disk. There are different types of file systems supported by Linux:

  • Conventional disk file systems: ext2, ext3, ext4, XFS, Btrfs, JFS, NTFS, etc.
  • Flash storage file systems: ubifs, JFFS2, YAFFS, etc.
  • Special-purpose file systems: procfs, sysfs, tmpfs, debugfs, etc.

File system hierarchy standards

The Linux system stores files according to a standard layout called the ‘file system hierarchy. The most common Linux directory structure is shown in Figure 1.

Linux online manual page

One of the key features of Linux is that it provides online help about every single command. To access the Linux manual (man) page, type the following command:

[bhargab@localhost~]$man ls

This will provide the manual page of the ls command.

Root or super user

This is a special kind of user account, which holds all kinds of permissions to do any alteration to a program or service of Linux. The su command is used to become a root or super user. Type the following command, and enter the root password to become a root or super user.

Figure 1
Figure 1: Linux file system hierarchy

Handling files and directories

In Linux, Everything is a file. This means that when we are dealing with normal text files or with device files, we interact with them through file operation related commands. Some operations on files are discussed below.

Creating a file: There are two commands to create a file: touch and cat. The touch command simply creates an empty file. Type the following command to create an empty document:

[bhargab@localhost~]$touch file1

cat is used to create and view a file. Type the following command to create a file:


To view a file type, use the command given below:

[bhargab@localhost~]$cat file1

Copying a file: The cp command is used to copy a file from one location to another, as shown below:

[bhargab@localhost~]$cp file1 /home/bhargab/Documents/

This command copies a file from the current working directory to /home/bhargab/Documents/.

Removing a file: To remove a file, type the following command:

[bhargab@localhost~]$rm file1

Renaming and moving a file: The mv command is used to move and rename a file. To move a file from one location to another, use the following command:

[bhargab@localhost~]$mv file1 /home/bhargab/Document

The above command will move file1 to the Document directory under /home/bhargab/.
To rename a file, file1 to file2, type the following command:

[bhargab@localhost~]$mv file1 file2

Listing files and directories: ls lists the contents (files and directories) of the current directory or specified directory. Type the following command to display the contents of the current directory:


This command simply lists the file name and directory name. To list all files in your home directory, including the hidden files, type the following command:

[bhargab@localhost~]$ls –a

To view files in a ‘long listing’ format, type ls with the -l option, as follows:

[bhargab@localhost~]$ls –l

A portion of the output is shown below.

total 48

drwxr-xr-x. 2 bhargab bhargab 4096 Jan 25 21:32 Desktop
drwxr-xr-x. 2 bhargab bhargab 4096 Apr 24 16:33 Documents
drwxr-xr-x. 6 bhargab bhargab 4096 Jan 20 23:55 Downloads
-rw-rw-r--. 1 bhargab bhargab    1024 Apr 28 22:18 file1
-rw-rw-r--. 1 bhargab bhargab    1024 Apr 28 22:01 file2
-rw-rw-r--. 1 bhargab bhargab    1024 Apr 28 22:01 file3
drwxr-xr-x. 2 bhargab bhargab 4096 Dec 20 08:48 Music
drwxr-xr-x. 2 bhargab bhargab 4096 Dec 20 08:48 Pictures
drwxr-xr-x. 2 bhargab bhargab 4096 Dec 20 08:48 Public
drwxr-xr-x. 2 bhargab bhargab 4096 Dec 20 08:48 Videos

The total, 48, indicates that the total number of disk blocks occupied is 48. There are nine columns in each of the lines. Each column in the succession represents the following – permission, number of links, owner name, group name, size in bytes, date and time, and file name. The permission field consists of 10 sub-fields. The first field represents the type of file. The next three fields represent owner (u) permission. The fifth, sixth and seventh fields represent group (g) permissions. The last three fields represent other (o) permissions. ‘w’ represents write permission, ‘x’ represents execute permission and ‘r’ represents read permission.

Hard link and soft link

A link is a connection between a file name and actual data in the hard disk. There are two types of these – the hard link and soft link.

A hard link can be created by typing the following command:

[bhargab@localhost~]$ln file1 file2

And a soft link by typing the following command:

[bhargab@localhost~]$ln –S file1 file3

Change Mod

In Linux, every file is associated with three types of permissions – read (r), write (w), and execute (x). The existing file permission can be changed by the owner of the file or the super user. The following command will embed a write permission to the group:

[bhargab@localhost~]$chmod g+w file1

Similarly, to give an execute permission to other users, use the command given below:

[bhargab@localhost~]$chmod o+x file1

In order to take away execute permissions from a group, type the following command:

[bhargab@localhost~]$chmod g-x file1

Current working directory

The pwd command displays the current working directory, as follows:


This means that the current working directory is /home/bhargab/.

Creating a directory

The mkdir command is used to create a directory, as follows:

[bhargab@localhost~]$mkdir myDir

This will create a directory, myDir, under /home/bhargab/.

Removing a directory

The rmdir command is used to remove an empty directory, as shown below:

[bhargab@localhost~]$rmdir myDir

rmdir with the -p option removes not only the specified directory but also parent directories.

[bhargab@localhost~]$rmdir - p myDir

In the next article, we wll cover topics like user account management, process management, and more.

To read other interesting articles: click here


  1. Absolutely perfect article for begineers who wanted to learn how to operate a Linux operating system. This document will help our team mates to understand the command line and most importantly the directory structure in Linux system.

    Thank you very much !!


Please enter your comment!
Please enter your name here