基本路径操作
- 转移目录用 cd
1
| mac@MacdeMacBook-Pro ~ % cd .
|
查看结果
1 2 3 4 5 6 7 8 9 10
| mac@MacdeMacBook-Pro ~ % ls Applications Public my_app Desktop StudioProjects node_modules Documents UBR_ZJ package-lock.json Downloads WeDrive package.json Library awesome-app platforms Movies bin shell.sh Music cookiefile.json statistics.json Pictures flutter_project Postman master
|
1
| mac@MacdeMacBook-Pro ~ % cd ..
|
查看打印结果
1 2
| mac@MacdeMacBook-Pro /Users % ls Guest Shared mac
|
1
| mac@MacdeMacBook-Pro ~ % cd ...
|
查看打印结果
1
| cd: no such file or directory: ...
|
1
| mac@MacdeMacBook-Pro /Users % cd
|
查看打印结果
1 2 3 4 5 6 7 8 9 10
| mac@MacdeMacBook-Pro ~ % ls Applications Public my_app Desktop StudioProjects node_modules Documents UBR_ZJ package-lock.json Downloads WeDrive package.json Library awesome-app platforms Movies bin shell.sh Music cookiefile.json statistics.json Pictures flutter_project Postman master
|
1 2
| mac@MacdeMacBook-Pro /Users % cd - ~
|
查看打印结果:
1 2 3 4 5 6 7 8 9 10
| mac@MacdeMacBook-Pro ~ % ls Applications Public my_app Desktop StudioProjects node_modules Documents UBR_ZJ package-lock.json Downloads WeDrive package.json Library awesome-app platforms Movies bin shell.sh Music cookiefile.json statistics.json Pictures flutter_project Postman master
|
- 创建目录
1
| mac@MacdeMacBook-Pro Desktop % mkdir zj
|
将会在当前目录下创建一个目录 zj
- rmdir:删除空目录
1
| mac@MacdeMacBook-Pro Desktop % rmdir zj
|
- pwd :打印当前的绝对路径名
1 2
| mac@MacdeMacBook-Pro Desktop % pwd /Users/mac/Desktop
|
查看路径操作
- 查看当前路径
1
| mac@MacdeMacBook-Pro Desktop % ls
|
- 查看隐藏文件
1
| mac@MacdeMacBook-Pro Desktop % ls -a
|
查看打印结果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| . Rebase .. SRSF .DS_Store SRSF-Swift .localized Swift学习 Blog XML学习 CSS学习 Xcode.app C语言学习 ZJActionSheet Demo_URL ZJBlog FMDB二次封装 ZJComponent Flutter ~$教育入学手册.doc HTML5学习 张建 JD 工具箱 Mac OS学习 王新月 OC学习 开发项目 Python学习
|
- 列表风格显示
1
| mac@MacdeMacBook-Pro Desktop % ls -l
|
查看打印结果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| total 8 drwxr-xr-x@ 16 mac staff 512 5 23 18:39 Blog drwxr-xr-x@ 3 mac staff 96 11 24 2022 CSS学习 drwxr-xr-x@ 38 mac staff 1216 5 8 14:20 C语言学习 drwxr-xr-x 7 mac staff 224 5 25 13:26 Demo_URL drwxr-xr-x@ 11 mac staff 352 4 17 20:51 FMDB二次封装 drwxr-xr-x@ 6 mac staff 192 5 22 20:49 Flutter drwxr-xr-x@ 13 mac staff 416 8 3 2022 HTML5学习 drwxr-xr-x@ 10 mac staff 320 5 23 19:05 JD drwxr-xr-x@ 3 mac staff 96 11 24 2022 Mac OS学习 drwxr-xr-x@ 11 mac staff 352 5 22 18:22 OC学习 drwxr-xr-x@ 35 mac staff 1120 11 25 2022 Python学习 drwxr-xr-x 4 mac staff 128 5 29 19:41 Rebase drwxr-xr-x@ 12 mac staff 384 5 23 19:02 SRSF drwxr-xr-x@ 11 mac staff 352 4 25 12:49 SRSF-Swift drwxr-xr-x@ 5 mac staff 160 5 8 12:52 Swift学习 drwxr-xr-x@ 5 mac staff 160 8 11 2022 XML学习 drwxr-xr-x 3 mac staff 96 11 17 2022 Xcode.app drwxr-xr-x 5 mac staff 160 5 29 17:11 ZJActionSheet drwxr-xr-x@ 17 mac staff 544 4 23 17:19 ZJBlog drwxr-xr-x@ 6 mac staff 192 5 10 20:32 ZJComponent -rw-r--r--@ 1 mac staff 162 7 16 2020 ~$教育入学手册.doc drwxr-xr-x@ 14 mac staff 448 5 12 15:12 张建 drwxr-xr-x@ 20 mac staff 640 5 21 17:24 工具箱 drwxr-xr-x@ 6 mac staff 192 4 2 18:07 王新月 drwxr-xr-x@ 13 mac staff 416 5 21 17:53 开发项目
|
- 配合 -l,显示一个合理的大小单位
文件操作
文件操作包括文件 复制、改名、移动、删除等,对文件操作多数也可以对目录操作
修改属性
cp:文件复制
1
| mac@MacdeMacBook-Pro Desktop % cp zj.txt 新文件名
|
- rm:删除文件(不能删除文件夹)
1
| mac@MacdeMacBook-Pro Desktop % rm zj.txt
|
- mv:文件改名
1
| mac@MacdeMacBook-Pro Desktop % rm zj.txt 新文件名
|
- find:查找文件
清屏
1
| mac@MacdeMacBook-Pro Desktop % clear
|
自动补全
tab 键
创建一个文件
1
| mac@MacdeMacBook-Pro Desktop % touch zj.txt
|