改变目录
cd path/to/dir:到指定目录cd ..:到父目录cd -:到上次所在目录cd:到home目录cd ~/path/to/dir:到home目录下指定文件夹cd /path/to/dir:到root目录下指定文件夹
文件操作
touch test.txt:新建文件test.txtrm test.txt:删除文件text.txtcp /path/to/original /path/to/copy:复制文件cp -r /path/to/original /path/to/copy:递归地复制文件夹mv /path/to/source /path/to/target:移动文件或文件夹
目录操作
mkdir tmp:新建目录tmprmdir tmp:删除空目录tmpmkdir -p tmp/nested/dir:递归式新建目录,创建嵌套目录时特别有用rm -r tmp:以递归形式删除非空目录tmprm -rf tmp:强制删除非空目录tmp,无须确认
查看目录
ls:列出当前目录下文件、目录pwd:查看当前所在工作目录tree:以树形结构显示当前目录ls -1:list files,每个一行(是1,不是小写的L)ls -l:long format list,显示权限等信息ls -a:同时显示隐藏文件ls -lh:同时显示文件大小,以human readable的单位(KB,MB,GB等)ls -lS:按文件大小降序排列ls -ltr:按修改时间逆序排列tree -L num:限制显示到指定层级(当前层级是1)tree -d:只显示目录tree -a:隐藏文件也显示


被折叠的 条评论
为什么被折叠?



