Friday, September 30, 2016

Commands to get the hardware information in Linux

RAM:

#cat /proc/meminfo
 Memory info in details
#cat /proc/meminfo | head -n 1
Only Ram
#free
Display amount of free and used memory in the system
#top
Check utilization
#lshw -short -class memory
Memory info
#hwinfo --short
probe for hardware
#dmidecode -t memory
Memory info
#vmstat -s
Memory info

CPU:
# cat /proc/cpuinfo
Display information about the CPU architecture
# lscpu
Display information about the CPU architecture
#top
Check utilization
#lshw -short -class processor
Processor info
#hwinfo --short
Probe for hardware
#nproc
Print the number of processing units available
#dmidecode -t processor
Processor info


Network info:
#lshw -class network
Network adapter information
#Ip a
Ip information
#Ifconfig -a
Ip information
#netstat
 Print network connections, routing tables, interface statistics
#ss
Utility to investigate sockets
#traceroute
Print the route packets trace to network host
#lsof -i tcp:portNumber
Check open port
#netstat -natu | grep 'ESTABLISHED'
Established Connections Only


Disk info:

#fdisk -l
Manipulate disk partition table
#lsblk
List block devices
#lshw -short -class disk -class storage -class volume
Storage info
lshw -short -class disk
Disk info
#lsscsi
list SCSI devices (or hosts) and their attributes
Use -s option to get size
#hdparm
 get/set SATA/IDE device parameters
hdparm -i /dev/sda
#mount | column -t
Mounted Filesystem info

Some more command to get info:

# cat /proc/version
Kernel version
#cat /proc/scsi/scsi
SCSI/Sata devices
#cat /proc/partitions
Partitions
#Pydf
Python df
#lshw -html > hardware.html
Generate report in html/xml format
#cat /proc/acpi/thermal_zone/THRM/temperature 
check temperature
#lspci
List pci devices
#lsusb
List usb devices