Linux useful commands

memory

  • free -mh

  • sar -r 2 2

  • ps -eo pid,comm,user,%mem,%cpu --sort=-%mem | head

free -m
[dev@dev-vm-422-centos home]$ free -mh
             total       used       free     shared    buffers     cached
Mem:           23G        21G       2.0G        50M       481M        17G
-/+ buffers/cache:       3.6G        19G
Swap:           0B         0B         0B
[root@sf-vm-1 dev]# ps -eo pid,cmd,%mem,%cpu --sort=-%mem | head
  PID CMD                         %MEM %CPU
  641 /usr/bin/python -Es /usr/sb  0.1  0.0
  664 /usr/bin/python -Es /usr/sb  0.1  0.0
  844 /usr/lib/polkit-1/polkitd -  0.0  0.0
  770 /usr/sbin/NetworkManager --  0.0  0.0
    1 /usr/lib/systemd/systemd --  0.0  0.0
  644 /usr/sbin/abrtd -d -s        0.0  0.0
 2421 sshd: rjin [priv]            0.0  0.0
  484 /usr/lib/systemd/systemd-jo  0.0  0.0
  645 /usr/bin/abrt-watch-log -F   0.0  0.0

CPU

  • sar -u 2 2

  • ps -eo pid,ppid,comm,user,%mem,%cpu --sort=-%cpu | head

  • nproc

  • lscpu

  • mpstat -P ALL 2 2

process

disk and files

network

accounts and permission

system

Last updated

Was this helpful?