How to use Linux mv commands

Source: Internet
Author: User

Syntax

Mv [options] source destmv [options] source... directory

Parameter description:

  • -I: if the specified directory already contains files of the same name, first ask whether to overwrite the old file;

  • -F: Do not give any instructions when the mv operation needs to overwrite an existing target file;

Mv parameter settings and running results

Command format Running result
Mv file name Change the source file name to the target file name.
Mv file name directory name Move the file to the target Directory
Mv directory name The target directory already exists.
Move to the target directory; target
If the directory does not exist, rename it.
Mv directory name file name Error

Instance

Rename the file aaa to bbb:

Mv aaa bbb

Put the info directory into the logs directory. Note: If the logs directory does not exist, this command will rename info to logs.

Mv info/logs

Another example is to move all the files and directories under/usr/student to the current directory. The Command behavior is as follows:

$ Mv/usr/student /*.

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.