Home Linux Linux Basics

Linux Basics

by Editorial Staff

How to change one directory to another directory?

[root@localhost redhat]# cd folder1
[root@localhost folder1]#

How to create a new file?

[root@localhost folder1]# cat>ams
hi
all
.....
[root@localhost folder1]#

How to go to the previous directory?

[root@localhost folder1]# cd ..
[root@localhost redhat]#

How to create a directory?

[root@localhost redhat]# mkdir linux1
[root@localhost redhat]#

How to create multiple directories?

[root@localhost redhat]# mkdir linux2, linux3, raju1
[root@localhost redhat]#

How to create a navigation directory?

[root@localhost redhat]# mkdir -p world/asian/india/ap/ts/hyd
[root@localhost redhat]#

How to visit the directory with the directory?

[root@localhost redhat]# tree world
world
└── asian
    └── india
        └── ap
            └── ts
                └── hyd


5 directories, 0 files
[root@localhost redhat]#

How to go to the India directory?

[root@localhost redhat]# cd world/asian/india/
[root@localhost india]#

How to go to the present directory?

[root@localhost india]# cd ..
[root@localhost asian]# cd ../..
[root@localhost redhat]#

How to delete a file from the directory?

[root@localhost redhat]# rm -i ravi
rm: remove regular empty file 'ravi'? y
[root@localhost redhat]#

How to remove a file directly?

[root@localhost redhat]# rm -f rj1
[root@localhost redhat]#

How to delete the directories?

[root@localhost redhat]# rm -ri raju1
rm: remove directory 'raju1'? y
[root@localhost redhat]#

How to create a copy command?

Example:

cp [option] <source> <target>here <source> is a sourcing file <target> is a destination file

[root@localhost redhat]# cp -i myfile dba
[root@localhost redhat]#

How to copy a file from the location?

[root@localhost redhat]# cp -i myfile world/Asian/india/ap/ts/hyd 
[root@localhost redhat]#

How to create a specific file?

[root@localhost redhat]# cp -i movie /home/redhat/world/asian/india/ap/ts/hyd
[root@localhost redhat]#

What is path?

A path is a unique location to a file or a folder in a filysystem of an OS. A path to a file is a combination of / and alphanumeric characters.

Paths are two types:

Absolute path:

An absolute path is difined as specifying the location of a file or a directory from the root (/) directory. 

In other words, we can say the absolute path is a complete path from start of the actual filesystem from / directory

Relative path:

It is defined as a path of the present working directory

How to move one file or directory from one place to another place?

[root@localhost redhat]# mv file1 file2
[root@localhost redhat]#

How to modify the time stamp?

[root@localhost redhat]# touch myfile
[root@localhost redhat]# ls -l myfile
-rw-r--r--. 1 root root 150 Aug 10 00:36 myfile
[root@localhost redhat]#

You may also like

Leave a Comment

Contact US

Phone Number

+91 XXXXX XXXXX

Location

2nd floor, # 85, SGR Dental College Rd, Marathahalli, Bengaluru, Karnataka 560037

Email Address

contact@dbacentre.com

    dbacentre.com is a website that publishes practical and helpful out-of-the-box articles for aspirants like you and me. In addition, we seek to present exceptional, remarkable tutorials and tips that modern cloud professionals will appreciate.

     

    Subscribe now

    Edtior's Picks

    by mukilan
    Sql
    by mukilan

    ©2023 Mr DBA CENTRE. All Right Reserved. Designed and Developed by Begintech.in