How to move files to a specified directory in Linux: You can use the mv command to move, such as [mv * ../], which means moving all files in the current folder to the previous directory. The mv command is used to rename files or directories or move files.
The function of mv command
The mv command is used to rename a file or directory or move a file 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.
(Recommended tutorial: linux video tutorial)
Format
mv [options] 源文件或目录 目标文件或目录
Main parameters
-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.
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) Move the files in a subdirectory of the current directory to another subdirectory
mv 文件名/* 另一个目录
(4) Move all files in the current folder to the upper directory
mv * ../
Related recommendations:linux tutorial
The above is the detailed content of How to move files to a specified directory in linux. For more information, please follow other related articles on the PHP Chinese website!