Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of moving files to a specified directory under linux

Shulou Source: shulou.com Published: 2022-06-02 01:05:20 09月10日 Update

How to move files to a specified directory under linux? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

The method of moving files to a specified directory under linux: you can use the mv command to move, such as [mv *.. /], which means to move all files under the current folder to a higher directory. The mv command is used to rename or move a file or directory.

The role of the mv command

Mv command to rename a file or directory or move a file from one directory to another. This command is equivalent to the combination of ren and move commands on DOS systems. Its permission is for all users.

Format

Mv [options] Source file or directory destination file or directory

Main parameters

-I: operate interactively. If the mv operation will result in an overwrite of an existing target file, the system asks whether to rewrite and asks the user to answer "y" or "n" to avoid mistakenly overwriting the file.

-f: interoperability is prohibited. The mv operation does not give any indication when it wants to overwrite an existing target file, and the I parameter will no longer work when this parameter is specified.

For example:

(1) move all files in / usr/udt to the current directory (with "." Represents):

$mv / usr/udt/*.

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

$mv test.txt wbk.txt

(3) move files from one subdirectory of the current directory to another subdirectory

Mv file name / * another directory

(4) move all files under the current folder to a higher level directory

Mv *.. / Thank you for your reading! After reading the above, do you have a general understanding of the method of moving files to a specified directory under linux? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Tags: File directory move command content method parameter target action subdirectory subdirectory folder article user system problem indication file name method more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Tech Info Huawei MySQL NVidia