linux常用命令行筆記

2021-06-29 07:35:13 字數 1015 閱讀 3452

登入root             sudo -i

查詢檔案路徑         find /etc -name b.cpp

可執行檔案路徑    which vi(vi安裝路徑,沒安裝就不顯示)

建立多級目錄         mkdir -p aa/bb/cc/dd

建立檔案             touch aa.xx

刪除檔案或目錄       rm -rf aa/bb

連線兩個檔案         cat a.cpp >> b.cpp      

cat a.cpp b.cpp >> c.txt

cat a.cpp > b.cpp   

cat a.cpp b.cpp > c.txt  

> 表示覆蓋 >>表示追加  

-n表示每行加上行號 -b表示非空格行加上行號

如:cat -b a.cpp >> b.cpp

cat -n /etc/profile

cat -b /etc/profile

顯示檔案內容         more /etc/profile

more -dc /etc/profile     顯示提示,並從終端或控制台頂部顯示;

more +4 /etc/profile      profile的第4行開始顯示;

more -4 /etc/profile      每屏顯示4行;

more +/mail /etc/profile  從profile中的第乙個mail單詞的前兩行開始顯示;

less與more相似,但在分頁上更靈活

重新命名檔案或目錄     mv a.cpp b.cpp

顯示檔案中所有檔案   ls a

反向顯示檔案內容    tac

顯示檔案前幾行      head -n num /etc/profile  (顯示profile中的前num行,預設顯示10行)

顯示檔案最後幾行    tail -n num /etc/profile  (顯示profile中的最後num行,預設顯示10行)

linux 命令列 筆記

1.tar tar命令 tar cvf file2.tar home usr2 file2 比如此命令 使用絕對路徑的話,歸檔時自動把 去掉。在解壓的時候,會在你的當前工作目錄出現home user2 file2 因為把 去掉了,所以他的父目錄就是當前的工作目錄。當採用相對路徑時,比如說在home下...

Linux命令列筆記

ipconfig 獲取ip位址 ping 8.8.8.8 檢視網路連線 ping 127.0.0.1 本地環迴位址,測試本地連通性 密碼破解 console ttyyo rd.break 進入中斷模式 mount o remount,rw sysroot 掛載到根分割槽 chroot sysroot...

linux命令列筆記

學習方法 看,寫,敲練 linux沒有碟符概念,只有根目錄 bin usr bin不能亂動容易損壞檔案 home裡面是使用者資料夾 學習的命令主要儲存在bin資料夾下 ls顯示當前資料夾下的檔案以及檔名 ls bin表示檢視根目錄下的bin資料夾的檔名 ls lime 表示查詢當前目錄下的lime資...