How to move files to a specified directory in linux

王林
Release: 2020-10-19 16:37:03
Original
79797 people have browsed it

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.

How to move files to a specified directory in linux

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] 源文件或目录 目标文件或目录
Copy after login

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/* .
Copy after login

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

$ mv test.txt wbk.txt
Copy after login

(3) Move the files in a subdirectory of the current directory to another subdirectory

mv  文件名/*  另一个目录
Copy after login

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

mv * ../
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!