linux 常用命令

2021-07-04 21:25:43 字數 3024 閱讀 4243

gg  跳轉首行

g 跳轉末行

1)、移動游標

h :游標左移乙個字元

j :游標上移乙個字元

k :游標下移乙個字元

l :游標右移乙個字元

0 :游標移至行首

$ :游標移至行尾

h :游標移至螢幕首行

m :游標移至螢幕中間

l :游標移至螢幕最末行

2)、插入文字

i :在游標前插內內容

a :在游標後插入內容

3)、刪除文字

x:刪除游標後面的字元

x:刪除游標前面的字元

nx:刪除游標後面n個字元

nx:刪除游標前面的n個字元

d0:刪除游標至行首的內容

d$:刪除游標至行尾的內容

dd :刪除整行

ndd :向下刪除n行

4)、複製文字

yy :複製整行

nyy :複製n行

dd :剪下

5)、查詢文字

/pattern :向下查詢

?pattern :向上查詢

n :順序查詢

n :反向查詢

:s/p1/p2/g :在當前行,將p1替換成p2

:n1,n2s/p1/p2/g :將n1至n2行之間的p1替換成p2

6)、螢幕翻滾

ctrl+u:向檔案首翻半屏

ctrl+d:向檔案尾翻半屏

ctrl+f:向檔案尾翻一屏

ctrl+b:向檔案首翻一屏

7)、末行命令

:n1,n2 co n3 :將n1至n2行複製到n3行的下面

:n1,n2 m n3 :將n1至n2行剪下至n3行的下面

:n1,n2 d :將n1至n2行刪除

:w 儲存

:q 退出

:x 儲存並退出

:q! 強制退出

:w! 強制儲存

:數字 定位到指定行

:set nu 顯示行號

:set nonu 取消行號

cat /proc/meminfo                      # 記憶體使用情況

unzip -d /temp test.zip # 解壓到指定資料夾

unzip -n -d /temp test.zip # 解壓到指定資料夾,並覆蓋

ln -s /home/apache tomcat # 建立軟連線

rm -rf tomcat   # 刪除軟連線,注意符號

systemctl start firewalld.service # 啟動firewall # centos 7

systemctl stop firewalld.service # 停止firewall

systemctl disable firewalld.service # 禁止firewall開機啟動

service iptables stop  # 關閉防火牆 # centos 6

service iptables start  # 啟動防火牆

service iptables restart  # 重啟防火牆

service iptables status  # 檢視防火牆狀態

chkconfig iptables off  # 永久關閉防火牆

chkconfig iptables on # 永久關閉後啟用

top # 查詢程序id和屬性的動態資訊

kill -9 id # 關閉程序

netstat -tunlp |grep 22 # 檢視22埠

pgrep -f tomcat # 檢視程序名字為tomcat的埠號

ps -aux|grep 程序名字 # 檢視程序號

cat /proc/3664/status # 檢視詳細記憶體占用

ps aux | grep defunct # 檢視殭屍程序

yum install man # 最小linux-minimal安裝man幫助

yum install man-pages

tail -n 5 log2014.log # 檢視當前最後5行

tail -500f log2019.log # 檢視動態日誌

cat filename | head -n 3000 | tail -n +1000 # 檢視1000~3000行日誌

du -s /usr # 查詢檔案夾總大小

du -sh /usr

jobs # 檢視後台啟動的程序

df -h # 檢視硬體資訊

free -m # 按兆為單位輸出記憶體的已用,未用,總共等結果

cat /proc/cpuinfo # 輸出各處理器的詳細資訊

ldd /usr/bin # 檢視可執行程式所用到的庫檔案

clear # 清空控制台

Linux常用命令之Linux常用命令實戰知識點

在在複習linux,這是以前做的筆記,分享一下。linux系統 一切皆檔案 操作檔案就是操作linux系統 一 linux版本 1 redhat 企業版 收費 2 centos redhat的社群版 免費 3 ubuntu 4 紅旗 二 linux的特點 1 多使用者 多工 2 豐富的網路功能 3 ...

LINUX常用命令

一 目錄結構 目錄名稱 意 義 vmlinuz 該目錄中存放的是系統核心 bin 該目錄中存放linux的常用命令,在有的版本中是一些和根目錄下相同的目錄。boot 該目錄下存放的都是系統啟動時要用到的程式,當用lilo引導linux時,會用到這裡的一些資訊 dev 該目錄包含了linux系統中使用...

linux 常用命令

ssh 連線 eg.ssh l mike www.mydomain.com or 192.168.0.1 scp 複製 本地 遠端 scp localfile username tohost newfile 遠端 本地 scp username tohost remotefile local 把tx...