There are several commands on Linux to fetch system information like number of cpus, partitions, their type and hardware information. In this article we will see few commands which are helpful to fetch information like mentioned above.
Command lscpu
The command lscpu will give the brief summary about cpu and cores. That is total number of cpus and number of cores per cpu are available on machine. The command output would be something like below describing cups and cores.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 2 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 58 Stepping: 9 CPU MHz: 1254.394 BogoMIPS: 4988.85 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 0-3 |
Command lspci
Command lspci will list all PCI devices available and recognized by kernel on machine
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
# lspci 00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09) 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09) 00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4) 00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4) 00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation HM77 Express Chipset LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04) 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series] (rev ff) 07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 05) 08:00.0 Network controller: Broadcom Corporation BCM43142 802.11b/g/n (rev 01) |
This command is useful to find available devices on machine and corresponding vendor.
Command procinfo
This command display system statistics gathered from /proc. That is you will get insight overview from file system /proc
This is command is useful to find,
Users, boot up time, load, swap, memory and interrupt etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
s# procinfo Memory: Total Used Free Buffers RAM: 8075912 5422088 2653824 629120 Swap: 4092924 37076 4055848 Bootup: Sun Jun 19 11:19:52 2016 Load average: 0.37 0.46 0.40 2/895 14009 user : 01:07:43.25 2.0% page in : 2202162 nice : 00:07:06.18 0.2% page out: 3703908 system: 00:18:09.06 0.5% page act: 2084699 IOwait: 00:30:13.51 0.9% page dea: 239956 hw irq: 00:00:00.04 0.0% page flt: 78776915 sw irq: 00:00:19.22 0.0% swap in : 1333 idle : 2d 05:06:32.92 96.3% swap out: 25034 uptime: 13:51:59.48 context : 64344840 irq 0: 18 timer irq 25: 0 xhci_hcd irq 1: 10656 i8042 irq 26: 0 eth0 irq 8: 1 rtc0 irq 27: 454653 0000:00:1f.2 irq 9: 87 acpi irq 28: 15 mei_me irq 12: 201507 i8042 irq 29: 532 snd_hda_intel irq 16: 345 16-fasteoi ehci_h irq 30: 127539 i915 irq 17: 1121122 17-fasteoi wlan0 irq 31: 27 radeon irq 23: 187 23-fasteoi ehci_h sda 193761r 200425w eth0 TX 0.00B RX 0.00B wlan0 TX 40.60MiB RX 186.85MiB lo TX 370.71KiB RX 370.71KiB |
Command lsdev
The command lsdev display information about installed hardware. This command also gathers some information from /proc file system and will give quick overview of which hardware uses what I/O addresses, what IRQ and DMA channels
Command lsblk
This is useful to list the block devices available. To list type the following,
lsblk
…
|
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 100M 0 part ├─sda2 8:2 0 98.5G 0 part ├─sda3 8:3 0 97.7G 0 part ├─sda4 8:4 0 1K 0 part ├─sda5 8:5 0 86.2G 0 part ├─sda6 8:6 0 92G 0 part ├─sda7 8:7 0 3.9G 0 part [SWAP] └─sda8 8:8 0 87.5G 0 part / sr0 11:0 1 1024M 0 rom |
Command lsusb
This command will list all available USB ports on machine.
|
# lsusb Bus 004 Device 003: ID 0a5c:21d7 Broadcom Corp. BCM43142 Bluetooth 4.0 Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 004: ID 064e:8125 Suyin Corp. Bus 003 Device 003: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub |
Command lshw
The command lshw will list the complete hardware information. It gives pretty big output. Try this out on your linux box to get complete hardware information,
lshw
Command df -ah
This command displays information regarding partitions something like used space, available space and file system type. To do so type following command
df -ah
Where option -a and -h are to list all volumes and display usage in human readable format respectively.
|
$ df -ah Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk1 92Gi 77Gi 15Gi 84% 20284234 3914932 84% / devfs 329Ki 329Ki 0Bi 100% 1137 0 100% /dev /dev/disk0s4 63Gi 3.6Gi 59Gi 6% 944196 15494636 6% /Volumes/Data /dev/disk0s5 77Gi 45Gi 32Gi 59% 11843161 8433770 58% /Volumes/Games map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home |
Command mount
The command mount is used for both to display mounted volumes information and mount the required volume at specified location.
To display mounted volumes and location, just type the following command
mount
As mentioned this can also be useful to mount paritions, to do so,
mount /dev/sda2 /location/to/mount
Where /dev/sda2 is the partition to mount at specified location
File /proc/interrupts
The /proc/interrupts contains the list of all supported interrupts by this CPU. This is nothing more than a file having information about interrupts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
cat /proc/interrupts CPU0 CPU1 CPU2 CPU3 0: 18 0 0 0 IO-APIC-edge timer 1: 166 1611 107 142 IO-APIC-edge i8042 8: 0 1 0 0 IO-APIC-edge rtc0 9: 26 14 2 1 IO-APIC-fasteoi acpi 12: 6601 51898 5272 4890 IO-APIC-edge i8042 16: 22 247 15 59 IO-APIC 16-fasteoi ehci_hcd:usb3 17: 8827 32076 2265 6273 IO-APIC 17-fasteoi wlan0 23: 29 114 12 32 IO-APIC 23-fasteoi ehci_hcd:usb4 25: 0 0 0 0 PCI-MSI-edge xhci_hcd 26: 0 0 0 0 PCI-MSI-edge eth0 27: 3506 25472 3876 18634 PCI-MSI-edge 0000:00:1f.2 28: 0 15 0 0 PCI-MSI-edge mei_me 29: 425 373 93 215 PCI-MSI-edge snd_hda_intel 30: 7204 21584 4192 4105 PCI-MSI-edge i915 31: 13 5 3 2 PCI-MSI-edge radeon NMI: 7 8 7 7 Non-maskable interrupts LOC: 135444 97512 127823 98675 Local timer interrupts SPU: 0 0 0 0 Spurious interrupts PMI: 7 8 7 7 Performance monitoring interrupts IWI: 0 3 0 0 IRQ work interrupts RTR: 2 0 0 0 APIC ICR read retries RES: 19153 18350 15877 15106 Rescheduling interrupts CAL: 1178 554 910 842 Function call interrupts TLB: 6742 6857 7333 6673 TLB shootdowns TRM: 4 4 4 4 Thermal event interrupts THR: 0 0 0 0 Threshold APIC interrupts MCE: 0 0 0 0 Machine check exceptions MCP: 9 9 9 9 Machine check polls HYP: 0 0 0 0 Hypervisor callback interrupts ERR: 0 MIS: 0 |