Detailed instructions on using mv commands in CentOS

Source: Internet
Author: User
Use the mv command to rename a file or directory or move the file from one directory to another. This command is equivalent to the combination of The ren and move commands in the DOS system. The permission is granted to all users. Format: mv [options] source file or directory target file or main parameter [options]-I: interactive operation. If the mv operation will overwrite the existing target file, the system will ask whether to rewrite the file and ask the user to answer "y" or "n" to avoid overwriting the file by mistake. -F: disable interactive operations. Mv operation required

Function
Mv command to rename a file or directory or move the file from one directory to another directory. This command is equivalent to the combination of The ren and move commands in the DOS system. The permission is granted to all users.

Format
Mv [options] source file or directory target file or directory

Main parameter [options]
-I: interactive operation. If the mv operation will overwrite the existing target file, the system will ask whether to rewrite the file and ask the user to answer "y" or "n" to avoid overwriting the file by mistake.

-F: disable interactive operations. When an mv operation overwrites an existing target file, no indication is given. If this parameter is specified, the I parameter will no longer work.

Select Parameters
When the parameter type is set to file, the mv command renames the file and renames the given source file or directory to the specified target file name.

When the selected parameter is an existing directory name, there can be multiple source files or directory parameters. the mv command moves the source files specified by each parameter to the target directory. When a file is moved across file systems, the mv copies the file first, and then deletes the original file. the link to the file will also be lost.

Application instance
(1) Move all files in/usr/udt to the current directory (represented:

$ Mv/usr/udt /*.

(2xx) rename the file test.txtto wbk.txt:
$ Mv test.txt wbk.txt


Related Article

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.