Home> System Tutorial> LINUX> body text

Basic linux commands - detailed explanation of mv

WBOY
Release: 2024-03-14 16:30:03
forward
827 people have browsed it

Basic linux commands - detailed explanation of mv

mv(option)(parameter) Cut, or move and rename in the same directory
1. If the target file is a folder, the source file is moved directly to 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 also be changed when it is moved
3. If there are multiple source files, the target must be a directory and moved to the directory simultaneously

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

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

-f: Force overwriting when the target file exists

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

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

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

-t: Specify the target first, then specify the source

[root@bogon admin]# mv -t b/ a/aa mv: overwrite `b/aa'? y [root@bogon admin]# ls a b a: bb b: aa bb
Copy after login

-v: display process

[root@bogon admin]# mv -fv a/aa b/ `a/aa' -> `b/aa'
Copy after login

The above is the detailed content of Basic linux commands - detailed explanation of mv. For more information, please follow other related articles on the PHP Chinese website!

source:linuxprobe.com
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
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!