Zero-based Linux 19th chapter (MV command details)

Source: Internet
Author: User

The zero-based Linux 19th Chapter


Hello~~ again to a week Update blog time ~ ~ This week 51CTO success will blog function upgrade ~ ~ To bring us a new experience ~ ~ New Interface ~ new visual Sense ~ ~ But, in the editor ~ small or accustomed to use the original editor, thanks to the staff in the time of the extensive adoption of the user's recommendations ~ Make changes to the blog again and again, well, the hardest part is our development comrade ~ ~ to you and all the staff to play call~~

Well, return to this chapter content, in fact, small series from this week is want to refuse to update ~ ~ Because so long past, small series although in always to students lectures, but I have not written a technical blog, but small series and not too much time a week to write two articles ....

Well... Small series found that there is no way to manually input pixels to adjust the size of the picture, can only drag .... The amount ... This is very hurtful to the small series ... And, can not choose to remove the watermark, well ~ ~ These are not OK ~ so back, although the small part of a bit refused to update, want to write a few technical blog, but, for the students, small, or wait for the time to write it ~ ~ (Spit Groove: Impossible, absolutely impossible, a week a lazy update of the small can be written! )


OK ~ nonsense not much to say, small make up to introduce this chapter of the content bar ~ ~

The last chapter, the small part of the students to explain in detail the CP Copy command, note that the copy command is supported by wildcard characters, flexible use of wildcards can be used to batch copy some files ~

Next, the small series to introduce to the students MV Mobile Command:

Mv:move, moving, indirectly renaming files

The command and the CP command usage is the same, so the small part of the command when introduced, not as detailed as the CP command, but the students will use the CP command will certainly be MV command ~ ~ also encountered a new command, or first look at the man document:

From the description of the man document, you can see that the MV command has no difference in the format of the CP command:

MV [OPTION] ... [-T] Source (origin) DEST (target)

MV [OPTION] ... SOURCE ... directory (Note: target is a directory)

MV [OPTION] ...-t DIRECTORY SOURCE ...

Seeing these, it should also be possible to think that the command used also divided into: single source and multi-source. But here is the term: single source mobile and multi-source movement. And its meaning is the same as the CP command introduced in the previous chapter, small series here do not do too much introduction ~ ~ Small series on the students directly to the example:

This is the simplest move file to move the text file under the current directory to the/app/directory. That is, the text makes the source, the/app/directory is the target, and this is the case that the target is the directory, and the directory does not have the same name as the source file, this method is the second usage listed above, then, When the destination you want to move has a file with the same name as the source file:

Small series first Look at the contents of/app/text this file:

Then, the gadget creates an empty file with the same name in another place and moves it over:

Can see, also will prompt us to overwrite the file, then, learned so many commands have the same hint, students have not guessed why this hint is why? Question ~ ~ Passers-by ~ ~

Passers-by: "Well, there should be a-i option, interactive, and the small one without the specified option, should be set the command alias" Alias "

Yes, absolutely right, reward a little flower ~ ~

As the passer-by says, the alias does have a mv= ' mv-i ' is the MV command actually using the Mv-i command, because any operation that could overwrite the file is considered dangerous, and the system defaults to adding an alias to us, and there are options for interactive.

The contents of the above overwritten files will also be replaced, then, when moving the file, you can also specify the name of the generated file:

If the target is a file and the file does not exist, the file is created in the directory where the target resides and the data stream of the source file is moved past. Small part of the concept mentioned here in the previous chapter has a detailed description, small series here do not do too much introduction ~ ~

-I: Interactive

I believe this option is not a small part of the said ~ ~ and the alias is set to use this option by default

-F: Mandatory

Small series Now/tmp/directory created a text file, and at this time the/app/directory also has a text file, so small series to the/tmp/directory of text file to move to the/app/directory, under normal circumstances, will be prompted to overwrite this file, and with the-f option, Will not prompt, force overwrite ~

The MV command can not only move the file, but also the ability to rename the file, that is, the name of the modified file, and this small series has been shown above ~ Move the/tmp/zzz file to the/app/directory and renamed to WWW, which is a cross-directory move and modify, you can also directly modify the file name in the source directory:

Rename the file under the current directory.


In fact, the MV Move File command options are many, but basically are not used, usually use only MV to move the file, if you want to study other options, students can view the man document OH ~


Well, although this chapter is a bit of water, but the small part of the first chapter to the end of it here ~ the Inode and block of the file and the execution results of the reference command wait until the next chapter to introduce to the students ~ today's small series can not afford to lift it ~ ~

Zero-based Linux 19th chapter (MV command details)

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.