linux 命令学习记录
文件操作
chown -R user file 修改文件所有者
chmod -R 777 file 修改文件權限wrx
mkdir -p dir1/dir2/dir3 創建目錄
rmdir -p dir1/dir2/dir3 刪除目錄(目錄為空)
cp source target 復制source到target
cp -s source target 創建target 軟鏈接到source (無法復制目錄)
ln -s source target 創建target 軟鏈接到source
rm -r dir 刪除目錄或文件(遞歸刪除文件)
cat -n file 顯示全部文件內容
tac -n file 倒序顯示文件內容
more file (space/enter/b)控制查看文件
less file (space/pageUp/pageDown)控制查看
head -n line file 查看頭line行內容
tail -n line file 查看最后line行內容
which command 查詢命令在path中的路徑
whereis filekey 查找文件路徑
locate filekey 查找文件路徑(數據庫 updatedb)
find path -name filename 查找文件(硬盤)
tar -cvf tar包名 源目錄 打包
tar xvf ?tar包名 ? 解包
vi編輯
一般模式 ESC
輸入模式 a
命令模式 :
一般模式:查找、刪除、復制、粘貼、移位、翻頁
查找 /word (n/N) 查找word n下一個,N上一個
刪除 x/X dd ndd x刪后,X前刪,dd刪一行
復制 yy nyy yy復制一行,nyy復制n行
粘貼 p/P p粘貼一行,P粘貼所有
位移 0 End 0首位 End末尾
翻頁 ctrl+f/b 下翻/上翻
命令:保存、退出、設置行號
保存 :w
退出 :q
設置行 :set nu
實用命令
切換用戶: su -l user
實用root權限運行命令: sudo command
遠程ssh登錄: ssh user@host
查看服務進程是否開啟: ps aux|grep "name"
監控進程占用機器負載: top -d 2 P(cpu)? M(內存)
殺死進程: kill -9 pid
轉載于:https://www.cnblogs.com/yinshen/archive/2013/02/17/2913852.html
總結
以上是生活随笔為你收集整理的linux 命令学习记录的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 安卓开发示例代码总结(持续更新中...)
- 下一篇: 批处理一键创建局域网共享文件夹或文件共享