Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of the Linux basic command mv

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the usage of the Linux basic command mv". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the usage of the Linux basic command mv".

Mv

Move the file or directory to another place, or rename it.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Mv [option] [- T] src dst

Mv [options] src directory

Mv [options]-t directory src

2. List of options

Option

Description

-- version

Display command version information

-- help

Show help documentation

-- backup= [control]

Create a backup for every file that exists

-b

Same as "--backup", but with no parameters

-f |-- force

Forced movement

-I |-- interactive

Move interactively

-n |-- no-clobber

Do not overwrite existing files. If more than one option in "- iMagne talk talk f" is developed at the same time, then only the last option is valid.

-- strip-trailing-slashes

Removes any trailing slashes from each source parameter.

-S |-- suffix=SUFFIX

Override the usual backup suffix

-t |-- target-directory

Move all source files to the destination folder

-T |-- no-target-directory

Treat the target as a normal file

-u |-- update

Move when the destination file does not exist or when the source file is newer than the destination file

-v |-- verbose

Show detailed execution process

3. Description

The backup suffix is'~ 'unless it is set to the'-'suffix or SSIMPLE_BACKUP_SUFFIX. Version control methods can be selected through the option of "--backup" or through the VERSION_CONTROL environment variable. Here are the values:

None,off: never back up, even if the "--backup" option is given.

Numbered,t: create a numbered backup.

Existing,nil: if there is a numbered backup, it is numbered, otherwise it is simple.

Simple,over: always create a simple backup.

4. Examples

1) move under the same directory, that is, rename.

[root@localhost weijie] # ls

1.c link link1 link2 my.iso test test01 wj234.q1C wjtpflR

[root@localhost weijie] # mv test01 test02

[root@localhost weijie] # ls

1.c link link1 link2 my.iso test test02 wj234.q1C wjtpflR

2) move to another place

[root@localhost test02] # ls

Test

[root@localhost test02] # mv test/ / weijie/testt

[root@localhost test02] # ls

[root@localhost test02] # cd..

[root@localhost weijie] # ls

1.c link link1 link2 my.iso test test02 testt wj234.q1C wjtpflR

Thank you for your reading, the above is the content of "the usage of the Linux basic command mv". After the study of this article, I believe you have a deeper understanding of the usage of the Linux basic command mv, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 266

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report