Learn Linux Quickly
上QQ阅读APP看书,第一时间看更新

Moving multiple files

You can also move multiple files the same way you can copy multiple files. For example, you can move the three files apple.txt, banana.txt, and carrot.txt from /tmp to /home/elliot/d1 as follows:

elliot@ubuntu-linux:/tmp$ mv apple.txt banana.txt carrot.txt /home/elliot/d1
elliot@ubuntu-linux:/tmp$ ls
cats2.txt cats.txt cities copycats.txt d1 d2 d3
elliot@ubuntu-linux:/tmp$ cd /home/elliot/d1
elliot@ubuntu-linux:~/d1$ ls
apple.txt banana.txt carrot.txt
elliot@ubuntu-linux:~/d1$

As you can see, the three files apple.txt, banana.txt, and carrot.txt are no  longer located in /tmp as they all moved to /home/elliot/d1. In general, the mv command follows the syntax:

mv source_file(s) destination