RHEL 7 Tutorial Managing Files and Directories

In Linux Operating System Everything is considered as a File. If you know Managing Files and Directories Effectively  that way you get more commanding on Operating system. In this Article We are going to learn RHEL 7 Tutorial Managing Files and Directories.

RHEL 7 Tutorial Managing Files and Directories

Creating files and multiple files at a time using touch command, let’s see practical examples

[root@ArkIT touch]#touch samplefile

[root@ArkIT touch]#touch file{1..10}.txt

Listing the files and directories using ls command

25 practical examples with ls command

Types of Files in Linux

File Type Symbol Description
Regular file Normal File
Directory d Directory can be stored with other files
Link l Shortcut to the original file
Special File c /dev file. Character device file
Socket File s The file system’s access control
Pipe p Special file that allows processes to communicate
Block File b Block Device File

Creating directories and parent directory structure using single command

# mkdir dir1

# mkdir -p /dir2/ravi/test

Copy files source to destination

cp is the command to copy the files

# cp anaconda-ks.cfg ravi wel /dir2/
cp: overwrite ‘/dir2/ravi’? y
cp: cannot overwrite directory ‘/dir2/ravi’ with non-directory

Copy Directories

# cp -Rv dir1/ /dir2/
‘dir1/’ -> ‘/dir2/dir1’

Move Files and Directories

Using mv command we can simple move files / directories from source to destination

# mv dir1/ /dir2/
mv: overwrite ‘/dir2/dir1’? y

# ls /dir2/
anaconda-ks.cfg dir1 ravi wel

Deleting files and directories 

rm is the command to remove / delete files and directories

# rm ravi
rm: remove regular file ‘ravi’? y
# rm -f wel
# rm -f touch/
rm: cannot remove ‘touch/’: Is a directory
# rm -rf touch/

That’s about RHEL 7 Tutorial Managing Files and Directories.

Related Articles

25 commonly used commands in Linux

find command with 30 practical examples

chmod command to grant file / directory permissions

Complete RHCSA and RHCE Certification study Guide

Thanks for your wonderful Support and Encouragement


My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

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