官术网_书友最值得收藏!

Renaming files

You can also use the mv command to rename files. For example, if you want to rename the file cats.txt to dogs.txt, you can run the mv cats.txt dogs.txt command:

elliot@ubuntu-linux:~$ mv cats.txt dogs.txt
elliot@ubuntu-linux:~$ cat dogs.txt
I love cars!
I love cats!
I love penguins!
elliot@ubuntu-linux:~$

If you want to rename the directory big to small, you can run the mv big small command:

elliot@ubuntu-linux:~$ mv big small
elliot@ubuntu-linux:~$ ls small
cities d1 d2

elliot@ubuntu-linux:~$

In summary, here is how the mv command works:

  1. If the destination directory exists, the mv command will move the source file(s) to the destination directory.
  2. If the destination directory doesn’t exist, the mv command will rename the source file.

Keep in mind that you can only rename one file (or one directory) at a time.

主站蜘蛛池模板: 砚山县| 同心县| 扎兰屯市| 永安市| 温宿县| 滨州市| 都安| 光山县| 乌海市| 金乡县| 准格尔旗| 临江市| 上饶县| 兴仁县| 浪卡子县| 射洪县| 德阳市| 丰顺县| 台东市| 贵溪市| 全南县| 垦利县| 托克托县| 鞍山市| 子长县| 吉水县| 镇平县| 赤峰市| 黄骅市| 上饶县| 彭州市| 嘉义市| 康定县| 定兴县| 竹北市| 桃园市| 资阳市| 陆川县| 上饶市| 贵州省| 成安县|