Linux Commands Hardware, System, Disk

Author avatar wrote on 10/06/2021

Linux Commands Hardware, System, Disk

Like for every thing, there are plenty of commands to check information about the hardware of your linux system.
Some commands report only specific hardware components like cpu or memory while the rest cover multiple hardware units.
This post takes a quick look at some of the most commonly used commands to check information and configuration details about various hardware peripherals and devices.

The list includes lscpu, hwinfo, lshw, dmidecode, lspci etc.

Introduction

How much space do I have free on my Linux drive?

Managing disk space on a Linux server is an important task. For example, package manager applications notify you how much disk space will be required for an installation. For that information to be meaningful, you should know how much space your system has available.

Hardware Information


#Show bootup messages:
dmesg
#See CPU information:
cat /proc/cpuinfo
#Display free and used memory with:
free -h
L#ist hardware configuration information:
lshw
#See information about block devices:
lsblk
#Show PCI devices in a tree-like diagram:
lspci -tv
#Display USB devices in a tree-like diagram:
lsusb -tv
#Show hardware information from the BIOS:
dmidecode
#Display disk data information:
hdparm -i /dev/disk
#Conduct a read-speed test on device/disk:
hdparm -tT /dev/[device]
#Test for unreadable blocks on device/disk:
badblocks -s /dev/[device]


System Information


#Show system information:
uname -r
#See kernel release information:
uname -a
#Display how long the system has been running, including load average:
uptime
S#ee system hostname:
hostname
#Show the IP address of the system:
hostname -i
#List system reboot history:
last reboot
#See current time and date:
date
#Query and change the system clock with:
timedatectl
#Show current calendar (month and day):
cal
#List logged in users:
w
#See which user you are using:
whoami
#Show information about a particular user:
finger [username]


Disk Usage


#See free and used space on mounted systems:
df -h
#Show free inodes on mounted filesystems:
df -i
#Display disk partitions, sizes, and types with the command:
fdisk -l
#See disk usage for all files and directory:
du -ah
S#how disk usage of the directory you are currently in:
du -sh
#Display target mount point for all filesystem:
findmnt
#Mount a device:
mount [device_path] [mount_point]