Linux-centos uses mv to move files to the specified directory

Foreword:

The method of moving files to a specified directory under linux: You can use the mv command to move, such as [mv * ../], which means moving all files in the current folder to the upper-level directory. The mv command is used to rename or move files or directories.

Format:

mv options 源文件/目录 目标文件/目录

The main parameters

-i: Interactive operation. If the mv operation will lead to the overwriting of the existing target file, the system will ask whether to rewrite, and the user is required to answer "y" or "n", so as to avoid overwriting the file by mistake.

-f: Disable interactive operation. When the mv operation wants to overwrite an existing target file, no instructions are given. After specifying this parameter, the i parameter will no longer work.

Example:

(1) Move all files in /usr/udt to the current directory (indicated by "."):

mv /usr/udt/* .

(2) Rename the file test.txt to wbk.txt:

mv test.txt wbk.txt

(3) Currently in the /var directory, move all the files in the /var/www directory to the /var/abc directory

mv www/* abc

(4) Move all files in the current folder to the upper directory

mv * ../

Guess you like

Origin blog.csdn.net/weixin_42517271/article/details/128552704