Linux經常使用命令總結--不斷補充

首先介紹一個頗有用的命令:history  查看linux機器上歷史命令。mysql

在Linux下查看內存咱們通常用free命令:free -mlinux

查看硬盤情況:df -h sql

查看cpu信息:less /proc/cpuinfo  
 
查看cpu的核數:less /proc/cpuinfo |grep 'model name' -c  
 
你的LINUX主機字符集(LANG):env | grep LANG 

查看進程:Ps –ef | grep mysql shell

殺死進程:kill -9 端口號 vim

查看端口 :netstat -ano | grep 3306tomcat

查看文件夾大小,並排序 :du -sh * | sort -nless

防火牆重啓後生效 
開啓: chkconfig iptables on 
關閉: chkconfig iptables off 

防火牆即時生效,重啓後失效 
開啓: service iptables start 
關閉: service iptables stop  ui

設置靜態ip地址spa

more  /etc/sysconfig/network-scripts/ifcfg-eth0日誌

ifconfig eth0 192.168.1.211 netmask 255.255.255.0

建立文件夾  :mkdir log

建立文件:touchlog 

移除目錄 :rm -rf /usr/lib64/mysql 

移除文件 rm log

複製文件:cp /mu /mu1

複製目錄:cp -R one two

切換目錄:cd

查看文件內容:cat

 

解壓 tar zxvf 文件名.tar.gz

壓縮 tar zcvf 文件名.tar.gz 目標名

vim三種模式:命令模式、插入模式、編輯模式。使用ESC或i或:來切換模式。

:q                      退出

:q!                     強制退出

:wq                   保存並退出

查詢
find / -name mysql
find / -iname "*.cnf" -print 
 
顯示日期:date
 

ls          顯示文件或目錄

     -l           列出文件詳細信息l(list)

     -a          列出當前目錄下全部文件及目錄,包括隱藏的a(all)

 

輸出tomcat運行日誌
tail -f /tomcat/logs/cataline.out

 

/etc/init.d/ntpd status 查看ntp服務狀態
/etc/init.d/ntpd start 啓動ntp服務

 

根據grep查詢關鍵字,會打印行號

grep -nH "Exception" catalina.out

根據行號定位日誌信息

sed -n '9796131,10172393p' catalina.out

 

xshell

sz 文件名  下載文件

相關文章
相關標籤/搜索