1. 創(chuàng)建/刪除文件夾
創(chuàng)建文件夾:mkdir python_Study(文件夾名)
[root@izm5eao2nl8wvngwz9ntdzz ~]# mkdir python_Study
刪除文件夾:rmdir python_Study(文件夾名)
[root@izm5eao2nl8wvngwz9ntdzz ~]# rmdir python_Study
2. 創(chuàng)建/刪除文件
創(chuàng)建文件:touch python_study.txt
[root@izm5eao2nl8wvngwz9ntdzz ~]# touch python_study.txt
刪除文件:rm python_study.txt
[root@izm5eao2nl8wvngwz9ntdzz ~]# rm python_study.txt
rm: remove regular empty file ‘python_study.txt’? y
其中rm 刪除命令中有幾個(gè)關(guān)鍵命令:
-i :每次執(zhí)行刪除命令時(shí)都會(huì)進(jìn)行詢問(wèn)
-r : 遞歸刪除文件并刪除含有文件的文件夾
-f :強(qiáng)制刪除文件(文件夾)
3. 查看目錄內(nèi)容 :ls
[root@izm5eao2nl8wvngwz9ntdzz code]# ls
date.py homework index.html mycal.py share_fish.py test.py
dump.rdb htm.txt index.html.1 numbers.py share_fish.py.bak test.py.bak
其中l(wèi)s 查看命令中
-l :列出較為詳細(xì)的內(nèi)容
-a : 列出隱藏的文件或者文件夾
-R : 用遞歸式顯示
4. 查看內(nèi)容:cat 、head 、tail 雀哨、more繁调、 less
cat date.py
[root@izm5eao2nl8wvngwz9ntdzz code]# cat date.py
print("==============")
print("seven one two three four five six")
print("==============")
head date.py
[root@izm5eao2nl8wvngwz9ntdzz code]# head -1 date.py
print("==============")
tail date.py
[root@izm5eao2nl8wvngwz9ntdzz code]# tail date.py
print("==============")
print("seven one two three four five six")
print("==============")
5. 拷貝和移動(dòng)文件: cp/mv
mv date.py news
[root@izm5eao2nl8wvngwz9ntdzz code]# mv date.py news
[root@izm5eao2nl8wvngwz9ntdzz code]# ls
dump.rdb htm.txt index.html.1 news share_fish.py test.py
homework index.html mycal.py numbers.py share_fish.py.bak
test.py.bak
[root@izm5eao2nl8wvngwz9ntdzz code]# cd news
[root@izm5eao2nl8wvngwz9ntdzz news]# ls
date.py
cp sohu.html backup
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cp sohu.html backup/
6. 查找文件和查找內(nèi)容 : find / grep
find index.html
[root@izm5eao2nl8wvngwz9ntdzz code]# find index.html
index.html
gerp