格式:mv [OPTION]… SOURCE… DIRECTORY
0 E) r/ c$ f8 \& C* A* v) B" o将目录/tmp/1下的某文件移动到目录/tmp/1/2下
8 e1 q5 m5 E3 u+ N! I9 \" u, i- [root@localhost tmp# ll /tmp/1/2/
- total 0
- drwxr-xr-x 3 root root 14 Nov 28 2017 3
- [root@localhost tmp# mv /tmp/1/test.txt /tmp/1/2/
- [root@localhost tmp# ll /tmp/1/2/
- total 0
- drwxr-xr-x 3 root root 14 Nov 28 2017 3
- -rw-r--r-- 1 root root 0 Feb 12 21:00 test.txt
- [root@localhost tmp# ' n+ p* j" ^% |6 l! ?' ]
将目录/tmp/1下的某文件移动到目录/tmp/1/2下并重命名 - [root@localhost tmp# mv /tmp/1/test.txt /tmp/1/2/test1.txt
- [root@localhost tmp# ll /tmp/1/2/
- total 0
- drwxr-xr-x 3 root root 14 Nov 28 2017 3
- -rw-r--r-- 1 root root 0 Feb 14 20:33 test1.txt
- -rw-r--r-- 1 root root 0 Feb 12 21:00 test.txt
- [root@localhost tmp#
* \+ w" k1 b1 _
/ d) `8 @' n% l3 j- j将tmp下的目录1移动到目录/tmp/qwe下+ W7 |/ z/ H2 t0 H) w- F! t9 O) P4 r
- [root@localhost tmp# ll /tmp/qwe/
- total 0
- [root@localhost tmp#
- [root@localhost tmp# mv /tmp/1/ /tmp/qwe/
- [root@localhost tmp# tree /tmp/qwe/
- /tmp/qwe/
- └── 1
- └── 2
- ├── 3
- │ └── 4
- │ └── 5
- ├── test1.txt
- └── test.txt
-
- 5 directories, 2 files
- [root@localhost tmp#
8 ]6 d( P" D- A! V2 G; e- T
将tmp下的目录qwe移动到目录/tmp/z下并重命名 - [root@localhost tmp# ll /tmp/z/
- total 0
- drwxr-xr-x 3 root root 14 Nov 28 2017 x
- [root@localhost tmp# mv /tmp/qwe/ /tmp/z/poi
- [root@localhost tmp# tree /tmp/
- /tmp/
- ├── rty
- ├── systemd-private-67f03791c3f34110b44cc9fe6c96389d-vmtoolsd.service-Nfell2
- │ └── tmp
- ├── yum_save_tx.2017-11-26.20-55.3OHjxh.yumtx
- └── z
- ├── poi
- │ └── 1
- │ └── 2
- │ ├── 3
- │ │ └── 4
- │ │ └── 5
- │ ├── test1.txt
- │ └── test.txt
- └── x
- └── c
- └── v
- └── b
-
- 14 directories, 3 files
- [root@localhost tmp# 4 [6 U |& |6 _" b. F; H$ \# Y
9 E/ O7 d* w8 `$ ~" q1 q
( [/ g4 h! @6 u4 z8 ?- d( S: [
|