cd.. 返回上級目錄
cd/ 返回根目錄
cd d: 進入d盤
cd test 進入當前目錄的test文件夾
./shutdown.sh 使用Tomcat關(guān)閉命令
ps -ef|grep java 查看Tomcat是否已關(guān)閉
進入到tomcat的bin目錄下,再執(zhí)行./version.sh 查看版本
cd /opt/tomcat/bin 進去bin目錄
cd ../ 返回上一級
cd / 返回根目錄
ls 列出文件
ll 列出文件
ll -a 列出隱藏文件
ll -rts 按時間排列列出文件,最新的在最下面
sz catalina.log 下載文件到本地
rz catalina.log 上傳文件到服務(wù)器
mv a b a重命名為b
mkdir lib 創(chuàng)建lib目錄
[root@mysql ~]# ifconfig -a // 查看所有網(wǎng)卡的信息(包括down狀態(tài)的網(wǎng)卡
[root@mysql ~]# ifconfig 0 // 查看指定網(wǎng)卡的信息
[root@mysql ~]# ifconfig eth0 up // 啟用指定的網(wǎng)卡,等同于:ifup eth0
[root@mysql ~]# ifconfig eth0 down // 關(guān)閉指定的網(wǎng)卡,等同于:ifdown eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth0 配置IP
ethtool -p eth0 使網(wǎng)卡port上的led不斷的閃
chmod +x cleaninstall.sh 開放腳本權(quán)限
chown root.root nginx.conf nginx.conf的文件所有者:root,組所有者:root
chmod -R 777 /opt/dahuaHA/ 賦777權(quán)限
file命令 查看文件類型
cat 由第一行開始顯示文件內(nèi)容
tail -f 用于顯示指定文件末尾內(nèi)容
tail -n 1000 evo-isms.log 用于顯示指定文件末尾1000行內(nèi)容
tail -f /log/evo-runs/evo-runs.log | grep GlobalListener
touch [file name] 創(chuàng)建空文件
kill -9 進程號 關(guān)閉進程
vi 進入vi編輯器 shift+g 跳到文件最下方
/ download.giz 在vim界面搜索 n鍵下一個
ctrl+u 頂部
ctrl+d 底部
: q! (不保存退出)
:wq!(保存退出)
top 類似于Windows的任務(wù)管理器
netstat -anotulp |grep 9000 |grep -v 127.0.0.1 查看有哪些是客戶端的IP
netstat -anotulp |grep 3306 查看端口 3306使用情況
netstat -anp|grep 117952 查看進程117952 相關(guān)的所有端口
lsof -i:8080 查看8080端口是否占用
pidof evo-eims 查看進程號
tar -zcvf test.tar.gz *.tx *.tx文件打包并壓縮為 test.tar.gz
tar -zcvf test.tar conf conf文件夾打包并壓縮為 test.tar
tar -zxvf test.tar.gz 將 test.tar.gz 解壓到當前目錄
tar -zxvf test.tar.gz -C /home 將 test.tar.gz 解壓到指定目錄
unzip LicTool.zip 解壓zip包到當前目錄
unzip -d /temp test.zip 解壓zip包到指定目錄
unzip CardSolution.war -d CardSolution 解壓war包到指定文件夾
rm -rf ... 刪除
killall -9 nginx 重啟nginx時,需先殺死nginx進程
- ln -snf /opt/a.txt /opt/b.txt
目標文件/opt/b.txt 連接到了 源文件/opt/a.txt
-
刪除軟連接
保險方式unlink /opt/a_ln.txt
tcpdump -i any -s0 -w all.pcap
tcpdump -i any port 9400 -s0 -w PES.pcap 對特定端口抓包
tcpdump -i any -s0 -w zhuatu_shebei2.pcap host 10.35.105.241 and port 37776 對設(shè)備抓包
-i any 監(jiān)聽所有的網(wǎng)絡(luò)接口
-s0 表示包不截斷,抓完整的數(shù)據(jù)包
-w 直接將包寫入文件中,并不分析和打印出來
iptables -A INPUT -p tcp --dport 8000 -j ACCEPT 打開端口號
iptables -A INPUT -p tcp --dport 8000 -j DROP 關(guān)閉端口號
service iptables save 保存端口設(shè)置
/sbin/iptables -L -n
iptables -nvL 查看所有防火墻
wireshark
ip.src == 192.168.0.1
ip.dst == 192.168.0.1
http.request.uri contains ""
cp -r eims eims_bak 遞歸復制
cp -r /mnt/dss/index ./ 遞歸復制到當前目錄
pam_tally2 --reset 后面賬號鎖定了,找其他正常登錄的,執(zhí)行下以上
grep -rn 'abc*' 根據(jù)文件內(nèi)容查找
find / -name 'abc*' 根據(jù)文件名查找
env | grep LD_LIBRARY_PATH 或者echo "$LD_LIBRARY_PATH" =》動態(tài)庫查找路徑
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib 添加動態(tài)庫查找路徑
ldd -r xxx.so 命令查看so動態(tài)鏈接狀態(tài)和錯誤信息
echo '/lib' >ld_lib_path-x86_64.conf
ldconfig
df -h 查看服務(wù)器磁盤空間使用情況
free -h 查看服務(wù)器內(nèi)存使用情況
top
top -bn1 | grep evo-eims | awk '{print $6}' 查看服務(wù)占用內(nèi)存情況
jps -l 查看java相關(guān)的pid及程序所在包名
jmap -histo 94282|head -n20 分析相關(guān)進程的堆內(nèi)存
iotop
iostat -x 1 10 查看io情況,看util
lscpu
注意編寫的sh腳本里面不要有CR換行符
tree ** -N 樹型展示目錄
date -s 06/29/22 設(shè)置日期
date -s 16:25:00 設(shè)置時間
admin切換root用戶:su - root
!ps 最近的一個ps
arping -c 1 -w 1 -I eth0 10.56.23.153 檢測ip占用沖突(需要在非本身ip服務(wù)器上執(zhí)行)
mysql -h127.0.0.1 -umysql -pO7luOjDM