码迷,mamicode.com
首页 > 系统相关 > 详细

Linux/Unix 系统分析命令速查手册

时间:2014-07-30 03:14:53      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:使用   os   文件   io   数据   for   ar   linux   

1.Hardware

CPU information: cat /proc/cpuinfo

物理core个数: 统计core

逻辑CPU个数:统计processor

 

Memory information:

free -m

其中-+buffer是针对OS/App来说的.

 

Disk information:

fdisk -l

df -h

 

IO 性能:

iostat -d -x -k 1 10

此命令属于sysstat包

观察await 平均io operation等待时间

观察%util 一秒中IO操作所占时间百分比-->100%代表高负荷

 

统计某个目录的大小:

du -sh /root

 

统计该目录下所有目录大小:

du -cks *

 

dd命令:

制作交换文件

制作驱动盘

制作ISO

如: dd if=xx of =xx2 bs=65536 count=65536

 

查看平均负载:

top

uptime

w

过去1,5,15 mintues: the count number of process queue( ready )

如果r经常大于逻辑CPU个数且id < 50 ,则CPU负荷高.

 

整体系统性能的监控:

vmstat 1 10

process: r = 等待允许进程数 b=非中断睡眠态进程数

system: in = 中断数 cs = cpu switch

CPU: us = CPU 使用时间; sy = CPU 系统使用时间;  id =闲置

 

r<5, b~=0 normal state;

u%+s% < 70% 较好性能.

 

2.System

OS info:

uname -a

file /sbin/init

 

PCI:

lspci | grep "xxx"

 

主机名查询:

/etc/hosts

 

本机hostname:

/etc/sysconfig/network

 

配置DNS server

/etc/resolv.conf

namserver $IP_ADDR

 

3.Network

ifconfig -a

ping

netstat -an:

ESTABLISHED:并发数统计

CLOSE-WAIT:等待本地request

TIME-WAIT:等待足够时间对方连接中断的confirm;

统计命令:

netstat -an | awk ‘/^tcp/ {++S[$NF]}END{for(a in S)print a, S[a]}‘

 

其他:

telnet $IP_ADDR $PORT

nc -nvv $IP_ADD $PORT

 

route:

route  = netstat -r

route -n

traceroute:跟踪数据包

 

route add -net 192.168.20.0 netmask 255.255.255.0 gw 192.168.10.1

route add -host $IP_ADDR dev eth0

开机启动添加: /etc/rc.local

 

nslookup:IP address <--> domain name

>mail.163.com

Server: 10.1.1.1

Address: 10.1.1.2

 

or command --> dig

dig www.baidu.com +trace

 

finger = w

 

lsof -i:22

查看22端口由哪些program占用

(ls opened file)

 

sockstat: -c = connected; -l = listening

 

ps命令:

ps -axu

VSZ: virtual memory size (kb)

RSS: 物理内存(kb)

STAT:

D - death

R - ready

S - sleep

T - trace

Z - zombie

< - High priority

N - Low priority

 

top命令:

PR: priority

NI: priority number

VIRT: virtual memroy used

RES:  physical memory used

SHR : share memory used

STAT: S - sleeping ; R - Running ; Z - zombie ; N - Low priority

交互命令:

P - CPU排序; M - 内存排序; T - 时间排序; c - 完整command; 

 

kill & killall 命令;

Linux/Unix 系统分析命令速查手册,布布扣,bubuko.com

Linux/Unix 系统分析命令速查手册

标签:使用   os   文件   io   数据   for   ar   linux   

原文地址:http://www.cnblogs.com/clor001/p/3876838.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!