Home>Article>Operation and Maintenance> How to modify directory name in linux

How to modify directory name in linux

青灯夜游
青灯夜游 Original
2021-12-24 18:07:14 33677browse

In Linux, you can use the "mv" command to modify the directory name. This command can not only move files or directories between different directories, but also rename files and directories; modify the directory name. The syntax is "mv old directory name new directory name".

How to modify directory name in linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

In Linux, you can use the "mv" command to modify the directory name.

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

mv 【选项】 源文件 目标文件

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.

Example: Rename directory A to B

mv A B

Example: Move directory /a to /b and rename it to c

mv -r /a /b/c

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to modify directory name in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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