Learn file management commnad line required for RHCSA

3.0 Introduction to Red Hat Linux Key file system

Welcome back, in this ‘RHCSA examination preparation guide’ series two articles are published, this is third part of the series in continuation, in previous two articles we understood basics of Red Hat Enterprise Linux including Installation, system registration to Red Hat network, then we learned few Linux basic commands, what is bash, what is Linux terminal. Let us move ahead, as we know that everything in Linux is a file, all of the configurations settings, drivers software etc. everything is stored in Linux as editable text file, therefore to govern Linux System it is must for Linux user or administrator to understand key files which act as skeleton of the system, every file or directory in Linux architecture is designated to play some unique and important role, such files/directories are called system default files/directories. Any defect in these configuration files or some unauthorized access to the files can give some serious damage to the system, some important key files and directories are common for all of Linux distributions.

3.1 Understanding Linux file system hierarchy

Slash is known as the root directory, rest of the files and directories resides under root (/), this is like the root of a tree where rest of the files/directories are like branches of that root. Important to note there is no need to memorize all of the directories, you just need to understand only a few directories which are important from RHCSA exam preparation point of view have a look.

$ cd /
$ ls


Let us discuss every file system step by step

  1. /boot:/boot is a dedicated separate partition on hard disk. It stores Linux kernel and related files, initramfs and grub (boot loader). After BIOS process is handed over to /boot to boot the system, it contains kernel configuration options. Config-x-x-x It is a text file that contains kernel configuration options, have a look in that file. Give ‘uname -r’ command:


See the input, it will display kernel version installed. It has same extension as of config-x.x.x file. Initramfs It provides drives appropriately to find the root system, if you rename or remove that file your system will get the boot failure, so never tease /boot files. VM Linux It is the kernel itself. In a nutshell /boot contains all of the files which are required for boot process.

2. /usr: directory can be called software directory as in includes all installed software, shared libraries, user commands, directories which come under /usr are as follows:

2.1 /usr/local- Locally customized software goes under this directory.

2.2 /usr/bin- All of the command scripts resides under that directory.

2.3 /usr/local– All of the Administration related commands available under this directory.

3. /etc- All of the configuration files are stored in /etc/, all of servers or services which you will configure, have their editable configuration files stored under /etc.

4. /home- This is the directory where user stores all of their data, and configuration files, every user have their separated sub-directory under /home.

5. /tmp- This directory is also known as a temporary directory, where all of the temporary data is stored, it can be accessed equally by root and ordinary users.

6. /var- contains files that may change in size dynamically, like log files, spool or mail files.

7. /dev- contains files that is required by the system to interact with the hardware, these directories are mandatory for booting the system.

8. /proc- this file system provides access to kernel, cpu, memory related information can retrieve from that directory.

9. /media- By default optical or usb devices are mounted in that directory.

10. /lib, /lib64- Shared libraries that are utilized in /boot, /sbin and bin.

3.2 Essential Linux file management tasks

3.2.1 Absolutes paths and relative path

By default a user login to his home directory, when a user needs to handle certain xyz file or directory across the system, it is required to define the path of that xyz directory. Now, path of this particular directory can be defined by two methods, the first option is that user start defining address of xyz directory Starting from very top location i.e.  from slash and move down step by step to desired location of xyz, that is known as absolute path, absolute path will always begin with / (slash). Let us assume that we are logged in as user1 user, and wants to go to user2 directory, which is the home directory of another user, have a glimpse of below diagram.


Top parent directory is / under which home directory exist  and further under this home directory user2 directory exists which is over final destination. Let us type this path step by step:

$ cd /home/user2


Let us assume another scenario to understand relative path, we have discussed how we moved from top to down in  absolute path scenario. However, when you navigate from your current location  directly to xyz destination directly, then you follow relative path. The relative path will never start with slash(/) in any circumstances. Consider below diagram:



Let us move from user1 directory to user2 directory, we can see that both user1 and user2 are under /home directory, to switch from user1 to user2, move from user1 to /home(a step up), now move from /home to user2 (a step down). To move a step up from current location use following command.

$cd ../user2

Assume user was in his home directory (/home/user1) after above command you will move a step above (/home), now you can go down to user2 which is under /home (/home/user2).

3.2.2 Managing files with  use of command line tools

In this file management  section, we will discuss  how to – create directories and files, how to remove them, how to move them from one place to another and how to rename or copy any file or directory.

  1. mkdir – create a directory.

Syntex:       $mkdir <directory_name>

$ mkdir example

User ls command to have a look

dns(027)Create two directories with a single command


To create directories along with parent directory.

$ mkdir -p rajneesh/um1 rajneesh/um2 rajneesh/um3

-p option will create parent directory first, under this parent directory all three (um1, um2, um3) directories will be created, total 4 directories will be created.


2. rmdir- to remove a directory.

Syntex:  $rmdir <directory_name>


But, important to note that with rmdir you can remove only empty directories,  let us try to remove entire ‘rajneesh’ directory which possesses um2 and um3 subdirectories.

dns(031)3. rm – To remove files or the directories which are not empty, use -r option for recursive mode.

dns(032) 4. cp – to copy one file to another file, contents will be overwrite, or one file to another directory.

Syntex: $ cp file1 file2

In below example we created two different files with different contents, then copy file 1 to file 2 and see contents of file 2.


You can also copy one directory to another directory if directory is not empty use ‘-r’ option, let us assume following example,  create raj and ra1 directories, create a file in raj, now copy raj directory to raj1,

$ mkdir raj raj1

$ cd raj

$ touch file1

$ cd ..

$ cp -r raj raj1

Have a look of raj1 directory, contents of raj are present in raj1.


5. mv- To move one source (file or directory) to some destination.

syntex : $ mv  source destination

The difference between copy and move is that when you copy something the original source will remain there, but when you mv something, the original source will be removed automatically. In below example you can notice that only destination directory is present after mv command.


6. touch: used to create empty files.

Syntex: $ touch file1 file2

Create multiple files

$ touch file1 file2 file3 file4

Or you can create files in bulk, put a range in curly braces spaced by .., close the braces and add the file extension type as shown below.

$ touch {1..100}.txt



3.3 Conclusion

This was the third chapter of RHCSA preparation series, by the end of this chapter user will be able to understand the relative path and absolute path, few important key directories and their role, a user can remove, move or create files and directories. Is is recommended that user must practice all of the mentioned commands, use help manuals available on the internet. Although we are trying to include maximum of the mandatory part required to RHCSA preparation but still few things will get skipped, you can inform in that case.

3.4 DIY Practice for RHCSA Examination

On the basis of this chapter user is expected to perform following practicals:

  1. Create two named example1 and example2, crate cert1 under example1, and cert2 under example2, further, create test1 directory under cert2. Now move to test directory using an absolute path, then go to example1 from test using a relative path.

dns(037)2. Create 100 files with a single command having .mp3 extension.

3. Remove entire exampl2 directory and subdirectories with a single command.

3.5 Things we will include in next RHCSA tutorial

In next chapter we will understand the use “file globbing” or “global commands”, getting help using man pages, help commands, and detailed  understanding of text file editing with vim editor, file redirection etc.  Have fun!!

  • I’ve made 104000 dollars previous year by freelancing from home a­­n­­d I did it by w­orking part-time f­­o­­r few h every day. I used a money making model I found on-line and I am amazed that i made so much extra income. It’s newbie-friendly a­­n­­d I am just so happy that i learned about it. Here is what i did… STATICTAB.COM/x4biwaa

  • I have earned $104k last year by freelancing from my house and I was able to do it by wor­king in my own time f­­o­­r few hours daily. I was following a business opportunity I was introduced by this website i found online and I am so amazed that i earned such great money. It’s really newbie friendly a­n­d I’m so blessed that i discovered it. Here is what i did… http://WWW.WZURL.ME/hWF2-w

  • I got paid 104,000 thousand dollars last year by freelancing from home a­­n­­d I did that by w­o­r­k­i­n­g in my own time f­­o­­r 3 or sometimes more hours each day. I’m using a money making opportunity I was introduced by this company i found online and I am so excited that i earned so much extra income. It’s newbie friendly a­­n­­d I’m just so blessed that I found out about this. Here’s what I did… EASYURL.NET/f2265

  • I profited 104 thousand bucks in last twelve months by doing an on-line job a­n­d I was able to do it by w­o­r­k­i­n­g in my own time f­­o­­r 3 or sometimes more hrs on daily basis. I followed an earning model I stumbled upon from company that i found online and I am so thrilled that i was able to make so much money on the side. It’s newbie friendly and I’m so thankful that i learned about it. This is what i did… EASYURL.NET/9861f

  • I have made $104k in last 12 months by doing an on-line job a­n­d I did that by wo­rking part time for several hours every day. I followed a money making model I stumbled upon online and I am so thrilled that i was able to make such great money. It’s really beginner friendly and I’m just so grateful that i found this. Check out what I did… http://www.wzurl­.­me/UhyySA

  • I’ve made 104,000 bucks in last 12 months by freelancing from my house a­n­d I did that by w­orking in my own time f­o­r several hrs a day. I used a business opportunity I stumbled upon online and I am happy that I was able to earn such great money. It’s very beginner friendly and I’m just so blessed that i found this. Check out what I do… http://urlof­.­site/W3oi7

  • I was paid 104000 dollars in last 12 months by doing an online job from my house a­­n­­d I was able to do it by wor­king part-time f­o­r several hrs /daily. I was following a business opportunity I was introduced by this web-site i found on-line and I am thrilled that i made so much extra income. It’s so beginner friendly a­­n­­d I’m so blessed that i learned about it. Here is what i do… http://budget25­.­weebly­.­com

  • I was paid 104000 bucks last 12 months by doing an internet job and also I was able to do it by w­orking in my own time f­o­r several hours every day. I utilized work opportunity I found on the net and also I am thrilled that I was able to make such decent money. It’s undoubtedly newbie-friendly and therefore I’m so pleased that I discovered out about it. Go and visit exactly what I do… http://urll­.­in/Ohhu2

  • M­a­n­y p­e­o­ple desire t­o ha­v­e a high earnings at their, bu­t t­he­y don’t have much idea ho­w t­o exactly d­o th­at o­n th­e Int­ernet. Th­ere ar­e a many w­ays t­o ea­rn great am­ount of mo­ney, b­ut wh­enev­er p­eopl­e t­ry th­at the­y g­et tr­app­ed in a fraud, Thus I am sh­aring wi­th yo­u a g­enuine an­d gu­arante­ed w­ay f­or fre­e to ea­rn hug­e am­ount of mon­ey a­t ho­me.I am earning atleast $10000 per month since a whole year.Its an internet based job and hassle-free to do, Even a little child can do this job and make money online. If you want a happy and wealthy life then you should copy and paste this internet site in browser and then follow instructions to get started right now and make Thousands Online……….. http://s­.­id/3Bm

  • Have you at any time generated huge profits without reselling a thing and without undertaking any sort of multi-level marketing sort of task and one never has to put money anything. I wanted to talk about a job in which pretty much all methods is certainly handovered to you and as a consequence it is an easy and also not difficult work. No need to startup your personal domain names etc., all is definitely delivered to you without spending a dime. Individuals are likely to browse your website so you are able to get money for that. It is actually as simple as that. I am making huge amounts of funds in a home office using this task such as 20 thousand bucks monthly or more just in case you too would like to get paid similar to that then follow these effortless manuals by seeing this internet site >>>>> GOCHIURL.COM/15d8x

  • I w౦uןd liĸe t໐ ƽhow yoц a fantɑstιc wαy үoᴜ ϲaϖ geτ ϱaid ƽ೦me incoмe eveᴦy week by ɯorкᎥng Ꮟasic taƽks οveг ѡeᖯ ſrom үouᴦ lіᴠіng ᴦo๐m foг sevеᴦal հᴦƽ ɑ 〳ԁαy ~  Ϲliᴄk oᴨ the w℮ЬƽᎥte GET.LC/5QJ7L


  • I tried freelancing over world-wide-web, via doing some fundamental opportunities which just simply requisite your personal computer and also usage of internet and additionally Now I am delighted than ever… half a year have passed when i started this and i received money full amount of of 36,000 dollars… Basically I make 80 bucks each and every hour and also work for 3 to 4 hrs majority of the times.And attractiveness of this is exactly that you can organize time whenever you work and for how long as you like and you earn a paycheck each week. —->>>LEARN Even more Regarding It here-> GOCHIURL.COM/15cf7