- Learn Linux Quickly
- Ahmed AlKabary
- 137字
- 2021-06-11 18:43:49
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:
- If the destination directory exists, the mv command will move the source file(s) to the destination directory.
- 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.
推薦閱讀
- FreeSWITCH 1.8
- 編寫高質量代碼:改善Python程序的91個建議
- CouchDB and PHP Web Development Beginner’s Guide
- Easy Web Development with WaveMaker
- Teaching with Google Classroom
- Angular開發入門與實戰
- Raspberry Pi Home Automation with Arduino(Second Edition)
- Flowable流程引擎實戰
- OpenMP核心技術指南
- QPanda量子計算編程
- Sails.js Essentials
- 超簡單:用Python讓Excel飛起來(實戰150例)
- 測試工程師Python開發實戰
- MySQL核心技術與最佳實踐
- 面向對象分析與設計(第3版)