linux實用命令彙總

2021-05-25 01:27:03 字數 1366 閱讀 1313

1,檢視linux版本: lsb_release -a.

2,獲取當前核心名稱和其它資訊: uname -a

3,查詢當前資料夾下所有.***檔案,並強制刪除: find ./ -name "*.***" | xargs rm -rf

4,在當前目錄下的所有普通檔案中搜尋hostnames這個詞: find . -name /* -type -f -print | xargs grep "hostname"

5,打包檔案example下檔案,除過資料夾lib下的檔案:tar --exclude example/web-inf/lib -zcvf bak/example2010-12-15.tar.gz example/*

6,後台執行程式(啟動程序)

7,copy檔案,當檔案已經存在的情況下覆蓋 /cp /var/log/httpd/new.log/var/log/httpd/old.log

8,檔案同步,同步192.168.1.100伺服器上的new.log_2到當前資料夾下:編輯100上的/etc/rsyncd.conf

新增path = /var/log/httpd

commnet = counter log

rsync -a 192.168.1.100::counter/new.log_2 .

9,tomcat伺服器的重啟,設定定時任務*/3 * * * * root /root/shell/monitor.sh

在shell下編寫monitor.sh

tomcat_dir=/usr/local/apache-tomcat-6.0.9

shell_dir=/root/shell

result=`cat result.txt |grep "200 ok"|sed -n 1p`

if [ -z "$result" ]

then

kill -9 $pid

sleep 5

cd $tomcat_dir/bin/

. ./myconfig.sh

./startup.sh

date '+%f  %t' >> $shell_dir/times.txt

else

exit 0

fi10,檢視伺服器負載:top命令是linux下常用的效能分析工具,能夠實時顯示系統中各個程序的資源占用狀況,類似於windows的任務管理器

11, 列印當前系統活動摘要:w 顯示目前登入系統的使用者資訊

12,df 統計檔案系統的使用情況:df -h

13,du統計每一目錄的使用情況:du -sh * 檢視每個檔案和目錄的大小

linux實用命令彙總

1,檢視linux版本 lsb release a.2,獲取當前核心名稱和其它資訊 uname a 3,查詢當前資料夾下所有.檔案,並強制刪除 find name xargs rm rf 4,在當前目錄下的所有普通檔案中搜尋hostnames這個詞 find name type f print xa...

linux實用命令彙總

1,檢視linux版本 lsb release a.2,獲取當前核心名稱和其它資訊 uname a 3,查詢當前資料夾下所有.檔案,並強制刪除 find name xargs rm rf 4,在當前目錄下的所有普通檔案中搜尋hostnames這個詞 find name type f print xa...

Linux實用命令彙總(持續更新 )

經常會為某個簡單的命令名google,baidu,於是覺得有必要自己開個頁面,持續的更新這些命令。命令 argc 使用例子 if ne 1 then echo usage 0 tabname echo e.g.0 cdr 20110114 exit 1 fi命令 find type f實用例子 列印...