Home  >  Article  >  Operation and Maintenance  >  What is the command to change the file name in Linux?

What is the command to change the file name in Linux?

WBOY
WBOYOriginal
2021-12-24 15:40:4756681browse

The Linux command to modify the file name is "mv". The mv command is the abbreviation of "move file". It is used to rename files or directories, or move files or directories to other locations. The syntax is "mv old file" new file name".

What is the command to change the file name in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the Linux command to change the file name?

The Linux mv (English spelling: move file) command is used to rename a file or directory , or move the file or directory to another location.

Syntax

mv [options] source dest
mv [options] source... directory

Parameter description:

  • -b: When the target file or directory exists, a file will be created for it before overwriting is performed. Backup.

  • -i: If the source directory or file specified to be moved has the same name as the target directory or file, you will first be asked whether to overwrite the old file. Enter y to overwrite directly, and n to cancel. This operation.

  • -f: If the source directory or file specified to be moved has the same name as the target directory or file, no query will be asked and the old file will be overwritten directly.

  • -n: Do not overwrite any existing files or directories.

  • -u: The move operation is only performed when the source file is newer than the target file or the target file does not exist.

The format is as follows:

mv source_file(文件) dest_file(文件)

Change the source file name source_file to the target file name dest_file.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What is the command to change the file 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