首页  

Linux资源监控命令     所属分类 linux 浏览量 144
w 在线用户信息


uptime 
11:00:13 up 859 days, 20:21,  1 user,  load average: 0.04, 0.04, 0.05

启动时间 uptime -s 
2018-07-22 14:38:54

free -h
free -s 2
-s 2 2秒更新一次

df -h

-i 磁盘iNode信息
-T 显示文件系统类型

df -hiT

iNode数是该分区能够创建的文件个数,如果inode耗尽,将无法创建新文件

iotop -o 
查看正在读写磁盘的进程及消耗情况
iotop -p PID
iotop -u admin  # 查看admin用户磁盘读写情况

ps -ef|grep tomcat 

内存使用最多top7
ps -e -o pid,user,pcpu,pmem,rss,vsz,state --sort -pmem |head -7

CPU使用最多top7
ps -e -o pid,user,pcpu,pmem,rss,vsz,state --sort -pcpu |head -7

pstack pid

Thread 28 (Thread 0x7fddcc06f700 (LWP 15612)):
#0  0x00007fddcbc4cd12 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fddcad8724f in os::PlatformEvent::park(long) () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#2  0x00007fddcad89537 in os::sleep(Thread*, long, bool) () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#3  0x00007fddcab8248a in JVM_Sleep () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so

Thread 27 (Thread 0x7fddc868b700 (LWP 15614)):
#0  0x00007fddcbc4cd12 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fddcad8724f in os::PlatformEvent::park(long) () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#2  0x00007fddcad426ee in Monitor::IWait(Thread*, long) () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#3  0x00007fddcad42cce in Monitor::wait(bool, long, bool) () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#4  0x00007fddcaf32ff9 in VMThread::loop() () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#5  0x00007fddcaf33300 in VMThread::run() () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#6  0x00007fddcad89198 in java_start(Thread*) () from /root/soft/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
#7  0x00007fddcbc48dd5 in start_thread () from /lib64/libpthread.so.0
#8  0x00007fddcb557ead in clone () from /lib64/libc.so.6

vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 5  0      0  98784  79964 911768    0    0    58    52    0    0  1  1 98  1  0
 
-a 显示活跃和非活跃内存
-f 显示系统所有fork进程数量
-n 只显示一次指标名称
-d 显示磁盘相关信息
-p 显示指定分区信息
 
 
r: The number of runnable processes (running or waiting for run time).
b: The number of processes in uninterruptible sleep.

top

-c 显示完整命令行
-d 指定刷新时间
-p 指定pid
-n 指定刷新次数
-i 不显示闲置进程
-u 指定用户
-H 线程模式


最耗CPU线程
top -H -p PIDXXX

top -i 
top -ic 
top -icd 3

top - 11:17:54 up 859 days, 20:39,  1 user,  load average: 0.00, 0.06, 0.10
Tasks:  99 total,   1 running,  98 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.3 us,  1.0 sy,  0.0 ni, 97.3 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1883844 total,    71060 free,   793528 used,  1019256 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   875604 avail Mem 


进程运行状态 R(运行中)S(睡眠)T(停止)D(不可中断)Z(僵尸)等


ip addr ip -s link route -n 查看路由表信息 netstat -a (all)显示所有选项 -r 显示route路由表 -t (tcp)显示tcp相关选项 -u (udp)显示udp相关选项 -n 显示IP地址连接信息 -l 显示在监听状态下的socket连接 -p 显示程序名及ID -e 显示扩展信息 -s 按协议数据统计信息 -v 显示命令执行过程 iftop -i 指定网卡 -F 指定网段/掩码 iftop -F 192.168.1.0/255.255.255.0 ping telnet nslookup dig traceroute tcpdump tcpdump -vv -i eth0 tcpdump -i eth0 -w /xxx.log # 抓取数据写入文件 tcpdump -i eth0 dst host codefun007.xyz tcpdump -i eth0 host 192.168.0.10 and port 80
linux实用命令合集 linux运维常用命令

上一篇     下一篇
linux运维常用命令

JDK15 ZGC 测试

传说中的阿里味儿

Linux查找磁盘IO读写很高的进程

linux pidstat 命令

linux load 简介