Get computer info from Terminal

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

General computer info is obtained by:

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

To determine CPU speed on Linux 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.

For BSD, get reports of CPU temperature and current speed with

systemctl dev.cpu

Storage info is revealed by

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. Use lsblk when writing an SD card to setup a Raspberry Pi for example.

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 sets spindown time (after HDD unused this many minutes, spindown, here 30 minutes)

Get USB device name and hexadecimal Device Vendor and Product ID for connected devices.

lsusb

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

You’ll see lots of devices, even if no USB devices are visibly plugged into the 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
lsusb -v
detailed listing of all USB devices

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

lsusb -v | grep xHCI

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

Shows basic status for WiFi:

iwconfig

iw dev wlan0 station dump

gives more advanced information. wlan0 is the Wifi card interface name 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

Linux peripherals on serial ports are readily examined.


Reference