linux 常见命令

文本处理类

  1. less
  2. more
  3. cat
  4. head
  5. tail
  6. awk
  7. cut
  8. grep, egrep, fgrep #print lines that match patterns, egrep & fgrep deprecated
    -- grep -v abc /var/log #打印不匹配的行
    -- grep -c abc -r /var/log #显示每个文件有多少匹配的数量
    -- grep -n abc /var/log #前面打印行号
    -- grep -n -C 3 abc /var/log #context 信息前后各3行, 或者 -B (Before), -A (After)
    -- grep -r abc /var/log #recursive
  9. sort
  10. uniq
  11. wc

网络类:

  1. ip #查看管理设置网络地址, 路由等信息
    -- ip link
    -- ip add show
    -- ip neighbor show
    -- ip -h -s link
    -- ip help
    -- ip route help
  2. ifconfig
  3. netstat
    -- netstat -nlpt
  4. nstat
  5. ss
  6. curl
  7. wget
  8. telnet
  9. nc
  10. traceroute
  11. mtr
  12. dig
  13. nslookup
  14. host
  15. ping

内存类:

  1. free -m
  2. vmstat
    -- vmstat 1 3

磁盘类:

  1. df # 显示文件系统信息
  2. du # Summarize disk usage of the set of FILEs, recursively for directories
  3. iotop
  4. iostat
    -- iostat -t -x
    -- iostat -t -x 1 3

CPU 进程类

  1. lscpu
  2. mpstat
  3. top
  4. htop
  5. uptime
  6. ps
    -- ps -U xiatian -l
    -- ps --forest
    -- ps H 16705 #显示特定进程的线程信息
    -- ps -o ppid,pid,lwp,nlwp,%cpu,%mem,cputime,cmd,args k -%cpu H 16705 # 自定义输出列

系统设备类:

  1. dmesg Display or control the kernel ring buffer
  2. mount, umount

监控统计性能:

  1. sar #https://github.com/sysstat/sysstat
  2. vmstat
  3. dtrace
  4. systap
  5. ptrace
  6. strace
  7. ltrace
  8. iotop
  9. top
  10. iostat

系统软件管理类:

  1. rpm, yum
    -- rpm -a -q #查看所有安装的包
    -- rpm --last #查看最后安装的
  2. apt-get, apt-cache

系统其它类:

  1. w
  2. who
  3. whoami
  4. last
  5. mount/umount
  6. find
  7. cd, pwd, ls
  8. touch
  9. lsof
  10. which
  11. file
  12. chmod
  13. chown
  14. useradd

标签: none

添加新评论