这节练习中,你将学习使用mv
命令把文件从一个位置移动另一个位置。
$ cd temp
$ mv awesome.txt uncool.txt
$ ls
newplace uncool.txt
$ mv newplace oldplace
$ ls
oldplace uncool.txt
$ mv oldplace newplace
$ ls
newplace uncool.txt
$
> cd temp
> mv awesome.txt uncool.txt
> ls
Directory: C:\Users\zed\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/22/2011 4:52 PM newplace
d---- 12/22/2011 4:52 PM something
-a--- 12/22/2011 4:49 PM 0 iamcool.txt
-a--- 12/22/2011 4:49 PM 0 neat.txt
-a--- 12/22/2011 4:49 PM 0 thefourthfile.txt
-a--- 12/22/2011 4:49 PM 0 uncool.txt
> mv newplace oldplace
> ls
Directory: C:\Users\zed\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/22/2011 4:52 PM oldplace
d---- 12/22/2011 4:52 PM something
-a--- 12/22/2011 4:49 PM 0 iamcool.txt
-a--- 12/22/2011 4:49 PM 0 neat.txt
-a--- 12/22/2011 4:49 PM 0 thefourthfile.txt
-a--- 12/22/2011 4:49 PM 0 uncool.txt
> mv oldplace newplace
> ls newplace
Directory: C:\Users\zed\temp\newplace
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 12/22/2011 4:49 PM 0 awesome.txt
> ls
Directory: C:\Users\zed\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/22/2011 4:52 PM newplace
d---- 12/22/2011 4:52 PM something
-a--- 12/22/2011 4:49 PM 0 iamcool.txt
-a--- 12/22/2011 4:49 PM 0 neat.txt
-a--- 12/22/2011 4:49 PM 0 thefourthfile.txt
-a--- 12/22/2011 4:49 PM 0 uncool.txt
>
移动文件,或者重命名文件。这很简单: 给出就名字,然后新名字。
- 将
newplace
目录中的一个文件移动到另一个目录,在移动回来。