Killing Thunder Dog---Basic operation of files and directories of Linux No:10 Linux

Source: Internet
Author: User
Tags parent directory

We are often in the system operating files and directories, then we will first study the file and directory of the basic operation

These are commonly used commands, and we all have to play clear ...

We first use PWD to test ...

The PWD is mostly showing us in that directory, showing here/then it's much easier, we're following the directory.

For example, we go into the ETC directory and then use PWD to view, then he will also show us in the ETC directory.

If we need to exit this directory, then we CD. This will exit, as shown below:

How to use the CD command, in fact, this is very simple ...

For example, I want to enter the ETC directory then we just need to use the command CD etc so he can enter into the ETC directory.

If I need to quit, then use a CD. This will return to the parent directory.

If you enter the directory is deep, and we want to go directly to the directory and so very simple, only need to CD/So can be out to the directory, as follows:

So next we'll start using mkdir to create a leigood directory, as shown here:

It is clear here that we have successfully created the Leigood directory.

We have a command to create a directory. Then there must be a command to delete the directory, and we can delete it using RmDir, as shown below:

The creation of the directory with mkdir delete with RmDir a simple two-sentence command ah? Hehe ....

Then the file is actually very simple, the command is as follows:

The usage of touch is as follows:

So that we can clearly see that we have created a Leigood file in the home directory, hehe.

The use of file is as follows:

We first create an empty file test.conf and then we look at her, the results we can clearly be empty here is a blank file

We look at the etc/passwd file then he returns an ASCII text file where it is obvious that he is an ASCII file.

So file is to see the specific types of files ...

The use of CP is as follows:

CP We are just plain to copy shorthand Oh.

So we can copy out a leigood.txt file, hehe.

However, we sometimes want to copy a directory, then we need to use the-r parameter, because Linux does not allow us to copy the directory directly, as follows:

In the absence of-R is a failure, then we use-R to see

Just add-r to copy it.

How to use RM:

RM In fact this is similar to RmDir but RmDir is to delete the directory, RM is to delete files directly, but the use of the same ...

But when the deletion, he will be prompted whether you really need to delete, here and the deletion of Windows is actually the same oh, we only need to reply to a Y such a problem can be resolved.

So that the deletion is complete, hehe ...

Of course, you can also use RM to delete folders, but add a parameter-R

If you do not add-R then the direct deletion fails, plus-R then you can complete the deletion, and there is a warm hint, ask if we really delete.

If it is true, remove just add one more y, as shown below:

And then to see if it has been deleted successfully? Hehe ...

The effect is of course imaginable, hehe ...

(Warm hint, if the file is too many, each time to enter Y so annoying, you can also use f parameter problems can be solved, such as RM-RF home2)

The usage of the MV is as follows:

So we can find out that we've finished moving the Leigood.txt file from the home directory to/from the directory with the MV Move command Oh, hee.

Killing Thunder Dog---Basic operation of files and directories of Linux No:10 Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.