Skip to content

Instantly share code, notes, and snippets.

Linux中常用的監控CPU整體性能的工具有:
§ mpstat: mpstat 不但能查看所有CPU的平均信息,還能查看指定CPU的信息。
§ vmstat:只能查看所有CPU的平均信息;查看cpu隊列信息;
§ iostat: 只能查看所有CPU的平均信息。
§ sar: 與mpstat 一樣,不但能查看CPU的平均信息,還能查看指定CPU的信息。
在 Glances 的報表中,重要的狀態會用彩色的方式強調,以下是各種顏色所代表的意義:
綠色: 表示狀態一切正常(OK)。
藍色: 表示需要注意(CAREFUL)。
紅紫色: 表示警告(WARNING)。
紅色: 表示系統有問題了(CRITICAL)。
在 Glances 在執行時,可以用以下的按鍵來控制它:
「a」:自動排序模式,這會讓行程列表自動排序。
@m41039
m41039 / 好用的netstat指令
Last active May 9, 2021 09:18
好用的netstat指令
若要即時監控使用中的連線資訊,可以使用 watch :
watch -d -n0 "netstat -atnp | grep ESTA"
列出完整的 URL 位址
netstat -tup -W
這個指令可以將所有連線的 IP 位址列出來,並依照每個 IP 位址的連線數排序
netstat -an | grep ESTABLISHED | awk '/^tcp/ {print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr
用 awk 分析連線
@m41039
m41039 / gist:06bcdd4d6a7168d19007c455d7758945
Last active September 20, 2017 07:02
Bash_shell_script列出目錄及檔案數量
原文出處 http://benjr.tw/66816
ls 指令只能很簡單的看目前所有檔案,一些要列出 該目錄下 所有目錄及檔案數量 的顯示方式都沒有辦法,須要透過標準表示式才能完成,這些指令是在網路上找到的.
顯示檔案數目:
#ls -laR |grep "^-" |awk 'END{print "Number of files:"NR}'
顯示目錄數目:
話不多說,先來看以下的資料 (資料來源:http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats)
Apache Custom Log Formats (如果翻譯的不對,請糾正。)
Format String Description
%% 百分比符號
%a 遠端 IP 位址
%A 本機 IP 位址
%B 回應一個 request 的大小 (bytes),含 HTTP headers
%b 以 CLF 格式回應一個 request 的大小 (bytes),含 HTTP headers
#sample: /usr/share/doc/tmux/examples/
# {{{ screen-keys.conf
# $Id: screen-keys.conf,v 1.7 2010/07/31 11:39:13 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
@m41039
m41039 / 指令集
Last active December 27, 2017 01:14
若要即時監控使用中的連線資訊,可以使用 watch :
watch -d -n0 "netstat -atnp | grep ESTA"
列出完整的 URL 位址
netstat -tup -W
這個指令可以將所有連線的 IP 位址列出來,並依照每個 IP 位址的連線數排序
netstat -an | grep ESTABLISHED | awk '/^tcp/ {print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr
Linux如何找出佔用較大空間的檔案