Home > Article > Operation and Maintenance > How to modify directory name in linux
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".
#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!