Get computer info from Terminal

Linux has several tools to get computer information from Terminal, including over SSH. Here are some useful examples.

What other tools have you found useful for getting computer information from the command line–let us know in the comments below.

General computer info

dmidecode

dmidecode gives useful computer information from the Linux terminal, including over SSH. dmidecode can help in remote asset tracking and verification of Linux computers.

-t
selects type of dmidecode info. See man dmidecode for more categories 0-255.
  • Motherboard model # and serial #: dmidecode -t 2
  • BIOS version: dmidecode -t 0
  • CPU capabilities: dmidecode -t 4
  • CPU cache memory: dmidecode -t 7
  • RAM capability (maximum RAM): dmidecode -t 16
  • RAM installed: dmidecode -t 17

CPU speed

For Linux, I use powertop and tab over to frequency stats to see percent of time overall CPU and each core is in a particular speed and state. Getting point measurements isn’t as useful to me as modern CPUs are constantly switching state.

BSD

Get reports of CPU temperature and current speed with

systemctl dev.cpu

Storage info

lsblk

lsblk gives a tree view of connected storage, including: hard drives, SD cards, DVD/CD, USB drives, etc. This includes drives that are not mounted. I use lsblk when writing an SD card to setup a Raspberry Pi for example.

BSD

On BSD,

camcontrol devlist

gives hard drive device names like lsblk on Linux. /dev/ada0 is a common BSD HDD name.

To control HDD spindown time,

ataidle -I 30 /dev/ada0
-I 30
set spindown time (after HDD unused this many minutes, spindown, here 30 minutes)

USB devices

lsusb

gives the name and hexadecimal Device Vendor and Product ID for connected devices. This information does not rely on having a working USB driver, so if I’m troubleshooting why a USB device isn’t working in Linux, I issue before and after connecting

lsusb

and visually look for a new device to appear.

If the new device doesn’t appear, this could mean

  • the device requires an external (non-USB) source of power
  • the device cable/jack is broken
  • the device itself is broken
  • the computer/hub USB port is broken

Advanced

You’ll see lots of devices, even if no USB devices are visibly plugged into your computer. That’s because modern laptops have things like keyboards, touchpads, cameras, soundcards, SD Card readers, etc. internally connected via USB.

lsusb -t
tree view of connected USB devices
sudo lsusb -v
detailed listing of all USB devices

To see if a controller or devices is USB 3.0, try

sudo lsusb -v | grep xHCI

The USBview program gives a detailed GUI USB device tree view for Linux and Windows.

WiFi

iwconfig

Shows basic status for WiFi.

iw dev wlan0 station dump

gives more advanced information.

wlan0
Wifi card interface name

Wireless hardware

Typically, wireless cards including Wifi are on the PCI bus. Unless of course you have a USB WiFi adapter.

The wireless/WiFi chipsets can typically be identified by

lspci | grep -i wireless
grep -i
case-insensitive text search

Linux peripherals

Notes

Categories:

Updated:

Leave a Comment