Get the App
SLTechnology News&Howtos  ›  Development  › 

Usage Analysis of mv Command example of Linux

Shulou Source: shulou.com Published: 2022-06-01 18:33:56 10月26日 Update

Today Xiaobian to share with you the Linux mv command instance use analysis of related knowledge points, detailed content, clear logic, I believe most people are still too familiar with this knowledge, so share this article for your reference, I hope you read this article after some gains, let's take a look at it.

The mv command is used to rename files or directories, or to move files from one directory to another. Source represents the source file or directory, target represents the target file or directory. If you move a file into an existing destination file, the contents of the destination file will be overwritten.

mv(option)(parameter) cut, or move in same directory rename 1. If the destination file is a folder, the source file is moved directly into the folder, and the name is still the name of the source file. 2. If the target file is a file, the name of the source file will be changed at the same time. 3. If the source file is multiple, the target must be a directory and moved to the directory uniformly.

-b: When the target file exists, backup first and overwrite it

[root@bogon admin]# mv -b a/aa b/mv: overwrite `b/aa'? y[root@bogon admin]# ls baa aa~ bb

-f: Force overwrite when target file exists

[root@bogon admin]# mv -f a/aa b/[root@bogon admin]# ls baa bb

-i: Default option, prompt whether to overwrite when target file exists

[root@bogon admin]# mv -i a/aa b/mv: overwrite `b/aa'? y[root@bogon admin]# ls baa bb

-t: Specify target first, then source

[root@bogon admin]# mv -t b/ a/aamv: overwrite `b/aa'? y[root@bogon admin]# ls a ba:bbb:aa bb

-v: Display process

[root@bogon admin]# mv -fv a/aa b/`a/aa' -> `b/aa' Above is "Analysis of the use of mv command instances in Linux" All the contents of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: File destination directory source file knowledge article move command content name instance analysis folder different large parameter at the same time backup multiple most Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux Shulou Tech Info vpn Apple