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

How to modify directory name in linux

青灯夜游
Release: 2021-12-24 18:07:14
Original
33798 people have browsed it

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 【选项】 源文件 目标文件
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.

Example: Rename directory A to B

mv A B
Copy after login

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

mv -r /a /b/c
Copy after login

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!

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