linux_mv(用法分类和常用选项)

overview

though the mv command performs both file moving and file renaming,however,we could look it with a unified way:

with the effect of the mv,the name1 file/directory will no looger exist ,and the name2 file/directory will be exist.

mv file1 file2

将文件1移动到File2。 如果存在File2,则将其与File1的内容覆盖。 如果File2不存在,则会创建它。 在任何一种情况下,File1都不再存在。
Move file1 to file2. If file2 exists, it is overwritten with the contents of file1. If file2 does not exist, it is created. In either case, file1 ceases to exist.

mv -i file1 file2 (saver usage version)

Same as the previous command, except that if file2 exists, the user is prompted before it is overwritten.

mv dir1 dir2

If directory dir2 does not exist, create directory dir2 and move the contents of directory dir1 into dir2 and delete directory dir1.
(ok,you can consider it as rename the directory! at least ,the finally result is “the dir1 is renamed” )
If directory dir2 does exist, move directory dir1
(and its contents) into directory dir2.

mv file1 file2 dir1

Move file1 and file2 into directory dir1. The dierctory dir1 must already exist.

useful options

在这里插入图片描述
在这里插入图片描述

posted @   xuchaoxin1375  阅读(60)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2022-08-12 C++全局重载运算符访问类的私有变量(友元)/以“+“为例(交换律)
点击右上角即可分享
微信分享提示