Ubuntu 命令技巧(7)
发布时间:2013-06-24 来源:未知
=== 查看硬盘当前读写情况 ===
# 首先安装 sysstat 包
sudo apt-get install sysstat
#每2秒刷新一次
sudo iostat -x 2
== 进程 ==
=== 查看当前的内存使用情况 ===
free
usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]
-b,-k,-m,-g show output in bytes, KB, MB, or GB
-l show detailed low and high memory statistics
-o use old format (no -/+buffers/cache line)
-t display total for RAM + swap
-s update every [delay] seconds
-c update [count] times
-V display version information and exit
=== 连续监视内存使用情况 ===
watch -d free
# 使用 Ctrl + c 退出
=== 动态显示进程执行情况 ===
top
top指令运行时输入H或?打开帮助窗口,输入Q退出指令。
=== 查看当前有哪些进程 ===
ps -AFL
=== 统计程序的内存耗用 ===
ps -eo fname,rss|awk '{arr[$1]+=$2} END {for (i in arr) {print i,arr[i]}}'|sort -k2 -nr
=== 按内存从大到小排列进程 ===
ps -eo "%C : %p : %z : %a"|sort -k5 -nr