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


    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 命令;

  • 相关阅读:
    [HDU3487]Play with Chain
    [HDU3436]Queue-jumpers
    [HDU2475]Box
    [HDU1890]RoboticSort
    [BZOJ1500]维修数列
    [POJ3580]SuperMemo
    [POJ3481]Double Queue
    [BZOJ1269]文本编辑器editor
    简单的sql注入
    图片马的制作以及菜刀的使用
  • 原文地址:https://www.cnblogs.com/clor001/p/3876838.html
Copyright © 2020-2023  润新知