Linux文件目录操作指令
進入 home/itcast 目錄
?cd /home/itcast
ls 顯示目錄內容:
?ls
mkdir 創建一個目錄 家庭A:
?mkdir familyA
?
cd 切換目錄 進入familyA 目錄:
?cd familyA
ls 顯示當前目錄內容:
?ls
touch 新建空文件
?
?touch father.txt 家庭A中有一個父親
?touch mother.txt 有一個母親
?touch son.txt 兒子
?touch daughter.txt 女兒
mkdir 創建一個目錄
?mkdir house 房子
cd 切換目錄
?cd house
mkdir 創建目錄
?mkdir kitchen 廚房
?mkdir bathroom 衛生間
?mkdir roomA
?mkdir roomB
?mkdir roomC
?touch sofa.txt 沙發
ls 顯示目錄內容:
?ls 顯示
cd 切換目錄
?cd roomB
touch 新建空文件
?touch bed.txt
?echo "Your are the best boy." > book.txt 建立帶簡單內容的文件
?cat book.txt 查看文件內容
cd 切換目錄
?cd .. 返回上一級目錄
?cd roomC
touch 新建空文件
?touch bed.txt
?echo "Your are the best girl." > book.txt
?cat book.txt
?touch doll.txt
cp 拷貝文件
?cp doll.txt /home/itcast/familyA/house/roomB
cd 切換目錄
?cd ..
?cd roomB
ls 顯示目錄內容:
?ls 顯示
cd 切換目錄
?cd ..
mv 移動文件
?mv sofa.txt /home/itcast/familyA/house/roomB
cd 切換目錄
?cd roomB
ls 顯示目錄內容:
?ls 顯示
rm 刪除文件目錄
?rm doll.txt
?
more less 分頁顯示
?more book.txt
wc 顯示文檔行數,字數,字符數
?wc book.txt
find 查找指定的文件
?find -name book.txt
grep 查找指定字符串
?grep best book.txt
pwd 顯示當前目錄
tree 顯示目錄樹
rmdir 刪除空目錄
?rmdir bathroom
ln -s 建立軟連接
?ln -s /home/itcast/familyA/house/roomB /home/roomB
?
總結
以上是生活随笔為你收集整理的Linux文件目录操作指令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 节假日可以去办理交房子首付吗?
- 下一篇: 电脑msi怎么重装 msi电脑重装教程