This blog I am going to show some popular linux commands that I often use for monitoring system.

To know your hardware info

  • To know all hardware together

lshw

This will show all hardware info in long list. You may expect al list info in cli like this

lshw

  • You can get this same info in short form

lshw -short

And this you can expect in cli

lshw-short

  • You can save this info in a HTML file using this command.

sudo lshw -html > lshw.html

lshw-html

LSHW is an extension of LS commands with HW for hardware. It also has other extensions where you can see specific hardware group like pci devices.

  • To know about PCI devices

lspci

it will look like

lspci

And you can use these options

  • Produce machine-readable outputlspci -mm

  • Verbose output lspci -v

  • Show both textual and numeric ID’s lspci -nn

  • You may also use one of the oldest linux command to know this info.

sudo dmesg

This will show you very details like this

dmesg

  • Human-readable of dmesg sudo dmesg -H

Storage Info :

  • This will show all drive

lsblk

lsblk

  • To know IDs of all volumes

blkid

blkid

  • Showing all devices lsblk -a

lsblk-a

  • To know each device info individually

sudo fdisk -l

lfdisk-l

CPU Info

  • To know CPU info

lscpu

This will show info like this

lscpu

  • If you want to know only current cpu running speed

lscpu | grep MHz

lscpu

Memory Info

To know how much RAM/momory free in the system you can use free command. It has multiple options

  • Show in megabyte free -m
  • Show in gigabyte free -g
  • Show in kilobyte free -k
  • Show (default kilobyte) free
  • Show in human-readable form free -h

free

USB Info

  • To know USB device info lsusb. This will be shown like this

lsusb

  • To know this info in verbose lsusb -v

Kernel Info

To know linux kernel info details, uname is very good command.

  • To know kernel name use uname
  • To know kernel release version info uname -r
  • To know all info related to kernel uname -a
  • To know kernel version info uname -v
  • To know node name uname -n
  • To know machine name uname -m
  • To know OS name uname -o

uname

Process Monitor

  • To know currently running processes , use top. This will show like

top

  • To Manage process, we can use ps commands . PS reports a snapshot of the current processes.

simple ps will show

ps

  • To see every process on the system using standard syntax ps -ef
  • To get info about threads ps -eLf
  • To find a process with any name, for example Java, we can use this command ps -ef | grep java

ps-java

  • To see every process running as root (real & effective ID) in user format: ps -U root -u root u
  • If you want to kill any process , you can use kill command .

For example, a process with PIC 1000, you can kill this process by kill -9 1000

… This is a continuous post, I will add more later. Happy reading :)