I'm often sitting at a computer and need to know how it's equipped. Linux has many, many ways to find things out about a computer, but they are often complex and non-obvious. This is meant to act as a record of the best ways to extract information from a system. I'll try to use standard system utilities where possible, with upgrades for further information as appropriate. A good example is hard drives:
fdisk -l will tell you the size of the hard drive (and its partitions) but if you want to know the manufacturer and the condition of the drive, you should install smartctl - but it's not part of most default installs.
Most of these utilities require root access.
- This will show you all installed hard drives that the system is aware of (and USB storage devices), including all partitions, mounted or not. fdisk is a very old tool and may not work properly with GPT hard drives and/or drives over 2TB in size.
smartctl --all /dev/sdX
- May require you to install the smartmontools package. Will show you really extensive information about the hard drive (manufacturer, serial number, RPM, power-on hours ... a huge report) and allow the running of further tests.
- The quick and easy command to see how much memory you have available: I've added '-h' for 'human-readable' as most people prefer it to the raw numbers. This will also show you how much swap space is set up.
dmidecode | less
- This appears to be installed by default on Debian, but not on Fedora. Its extensive output is useful for many other things as well. Search within the output for "Memory" and it will tell you, for example, that the machine's maximum capacity is 8 GB, but that you currently have two sticks (listed separately) of DDR2 SODIMMs, each running at 667 MHz and made by Nanya, with serial numbers ... etc.
cat /proc/cpuinfo | less
- This will list the same, or very similar information multiple times if you have multiple cores or threads. It's quite thorough, although it tends to list current CPU speed without telling you the maximum.
lspci | egrep -i 'vga|2d|3d'
- The first string of the response probably looks like '00:02.0' or '01:00.0', which is the PCI device address (I think). To get more detail about the device, use
lspci -v -s 01:00.0.
lspci | egrep -i 'network|ethernet|wlan'and
lsusb | egrep -i 'network|ethernet|wlan'
- This should find most network adapters, but if you're getting no results and you believe there's something missing, run
lsusband look at the results yourself. As with the video card, more information about the network card can be had by feeding the PCI address back to the command:
lspci -v -s 03:00.0.
lshw -class network
- This is the extra credit version: this command isn't installed by default on either Debian or Fedora, but will give you considerably more information than the previous command.
upower --show-info `upower -e | grep 'BAT'`
- The stuff in backticks is replaced by the name of the battery device, and you're then shown extensive information about the battery. Inculding manufacturer, current charge, original design capacity, current maximum capacity, battery type, and more. This command appears to be available by default on both Debian and Fedora.
This is seriously unreliable!
xdpyinfo | grep dimensions
- This is potentially extremely misleading. On my primary machine, it gives an answer of '1920x1968 pixels (507x519 millimeters), where 1920 is the width of the wider of my two stacked screens and 1968 is the sum of the vertical pixels of the two screens (1200+768). But even if you're only using one screen, this isn't giving you all the information you probably want: it tells you what resolution you're running at NOW, not what the monitor is capable of. The millimeter measurements are actually 643x595, so that's pretty severely off too. This may be useful if you have a single monitor, but skip it completely if you have multiple monitors: see below.
xrandr | grep ' connected
- This shows the working screens separately, still doesn't show capabilities.
get-edid | parse-edid(Debian) or
- Each of these requires a non-standard package installation: on Debian, you need 'read-edid' and on Fedora you need 'monitor-edid'. 'EDID' = "Extended Display Identification Data" (@wikipedia), which - theoretically - digs into the display itself and gets its reported information. Reading online suggests that EDIDs are notoriously unreliable, and on one of my two test machines I got nada - zip, zilch, zero ... even with two screens present. On the other, also with two screens, I got the correct reading for the external monitor that I've never been able to get to run at its highest resolution, but nothing on the attached laptop screen - very strange.
- This command is available in the base install for both Debian and Fedora. This only shows configured devices, not ones that currently aren't functioning. For that, see 'USB Devices' and 'PCI Devices' below.
- Provides very similar information.
- Linux will list all the internal hubs inside the computer you never stopped to think about (and really don't care about). More detail can be had about a specific device by typing
lsusb -v -s 001:003- although this is a bit different formatting than the lspci command. '001:003' is of the form '<BusNum>:<DeviceNum>'. This will become clearer when you run the bare command.
- As seen above (Network Card, Video Card), more detail about a particular device is available through
lspci -v -s <PCIaddress>.