Sunday, November 1, 2015

Commands to get Hardware Information in Linux

1. lshw - List Hardware

    Lshw extracts the information from different /proc files.It reports detailed and brief information about multiple different hardware units such as cpu, memory, disk, usb controllers, network adapters etc.

2. lscpu

    This command reports information about the cpu and processing units. It does not have any further options or functionality.

3. hwinfo - Hardware Information

    Hwinfo is another general purpose hardware probing utility that can report detailed and brief information about multiple different hardware components, and more than what lshw can report.
   Command: $ hwinfo --short

4. Inxi

Inxi is a 10K line mega bash script that fetches hardware details from multiple different sources and commands on the system, and generates a beautiful looking report that non technical users can read easily.
    command: $ inxi -Fx

5. lspci - List PCI

    The lspci command lists out all the pci buses and details about the devices connected to them. The vga adapter, graphics card, network adapter, usb ports, sata controllers, etc all fall under this category.
    Filter out specific device information with grep.
   Command: $ lspci -v | grep "VGA" -A 12

6. lsscsi - List scsi devices

    Lists out the scsi/sata devices like hard drives and optical drives.

7. lsusb - List usb buses and device details

    This command shows the USB controllers and details about devices connected to them. By default brief information is printed. Use the verbose option "-v" to print detailed information about each usb port



8. lsblk - List block devices

To get the the list of all block devices, which are the hard drive partitions and other storage devices like optical drives and flash drives

9. df - disk space of file systems

Various partitions Information, their mount points and the used and available space on each.
    command: $ df -H

10. fdisk

To modify hard drive partitions Fdisk is a utility, and can be used to list out the partition information.
    command: $ sudo fdisk -l

11. Pydf - Python df

Its wriiten in python, that displays colored output that looks better than df


12. mount

The mount is used to mount/unmount and view mounted file systems.
    command: $ mount | column -t
                      $ mount | column -t | grep ext

13. free - Check RAM

Check the amount of used, free and total amount of RAM on system with the free command.
    command: $ free -m

14. hdparm

The hdparm command gets information about sata devices like hard disks.
    commnad: $ sudo hdparm -i /dev/sda

15. dmidecode

The dmidecode command is different from all other commands. It extracts hardware information by reading data from the SMBOIS data structures (also called DMI tables).
Commands:
    # display information about the processor/cpu
    $ sudo dmidecode -t processor

    # memory/ram information
    $ sudo dmidecode -t memory

    # bios details
    $ sudo dmidecode -t bios

16. /proc files

Many of the virtual files in the /proc directory contain information about hardware and configurations. Here are some of them   
    Commands:
    # memory information
    $ cat /proc/meminfo
   
    # cpu information
    $ cat /proc/cpuinfo

    #Partition Information
    $ cat /proc/partitions

    #Linux or Kernel Verison
    $ cat /proc/version

    #SCSI / Sata Devices
    $ cat /proc/scsi/scsi
   





No comments: