Home  >  Article  >  Operation and Maintenance  >  What is the file renaming command in linux

What is the file renaming command in linux

王林
王林Original
2021-01-25 11:52:5653709browse

The file renaming command under Linux is mv. The mv command is used to rename a file or directory or move a file from one directory to another. For example, [$ mv test.txt wbk.txt] means to rename the file test to webk.

What is the file renaming command in linux

The operating environment of this article: red hat enterprise linux 6.1 system, thinkpad t480 computer.

(Learning video sharing: linux video tutorial)

Detailed introduction:

linux The command to rename a file is the mv command

## The #mv command is used to rename files or directories or move files from one directory to another. This command is equivalent to the combination of the ren and move commands under DOS systems. Its usage rights are for all users.

Format:

mv [options] 源文件或目录 目标文件或目录

Main parameters [options]

-i: Interactive operation. If the mv operation will cause the overwriting of an existing target file, the system will ask whether to rewrite and require the user to answer "y" or "n" to avoid accidentally overwriting the file.

-f: Disable interactive operations. The mv operation does not give any instructions when overwriting an existing target file. After specifying this parameter, the i parameter will no longer have any effect.

Selection parameters

When the selection parameter type is a file, the mv command completes file renaming. It renames the given source file or directory to the given target file name.

Example:

Rename the file test.txt to wbk.txt:

$ mv test.txt wbk.txt

Related recommendations:

linux tutorial

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