Home > Operation and Maintenance > Linux Operation and Maintenance > How to use mv command to move files in linux

How to use mv command to move files in linux

醉折花枝作酒筹
Release: 2023-01-06 11:12:20
Original
10745 people have browsed it

In Linux, you can use the "[root@localhost ~]# mv option source file target file" statement to move files; the mv command (abbreviation of move) can move files between different directories or directory, you can also rename files and directories.

How to use mv command to move files in linux

#The operating environment of this tutorial: centos7 system, thinkpad t480 computer.

The mv command (abbreviation of move) can move files or directories between different directories, and can also rename files and directories. The basic format of this command is as follows:

[root@localhost ~]# mv 【选项】 源文件 目标文件
Copy after login

Options:

  • -f: Force overwriting. If the target file already exists, it will not ask and force overwriting directly;

  • -i: interactive movement, if the target file already exists, ask the user whether to overwrite (default option);

  • -n: if the target file If it already exists, the move will not be overwritten and the user will not be asked;

  • -v: Display the moving process of the file or directory;

  • - u: If the target file already exists, but the source file is newer than the two, the target file will be upgraded;

It should be noted that, similar to the rm command, the mv command It is also a destructive command. If used improperly, it is likely to bring disastrous consequences to the system.

(Recommended learning: linux tutorial)

The above is the detailed content of How to use mv command to move files in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template