mv的常用命令

[root@localhost demo]# ls
aaa  a.txt
[root@localhost demo]# mv ./a.txt ./aaa #移动文件到另一个文件夹
[root@localhost demo]# ls aaa
a.txt
[root@localhost demo]# ls
aaa
[root@localhost demo]# touch ab.txt
[root@localhost demo]# touch ac.txt
[root@localhost demo]# touch ad.txt
[root@localhost demo]# ls
aa.txt  ab.txt  ac.txt
[root@localhost demo]# mkdir dir1
[root@localhost demo]# mv a* ./dir1/  #移动多个文件到另一个文件夹中
[root@localhost demo]# ls dir1/
aa.txt  ab.txt  ac.txt
[root@localhost demo]#
[root@localhost demo]# ls
a.txt  dir1
[root@localhost demo]# mv a.txt a.txxxt #重命名
[root@localhost demo]# ls
a.txxxt  dir1
[root@localhost demo]# mv b.txt a.txt #相当于-i参数,覆盖前询问
mv: overwrite ‘a.txt’? n
[root@localhost demo]# mv -f  b.txt a.txt #强制性覆盖
[root@localhost demo]# ls
a.txt  dir1
posted @ 2024-12-30 21:22  鲁班大师智商二百五  阅读(10)  评论(0)    收藏  举报