Commands to know the system (identify hardware and some software configurations)

A few days ago we saw how to install Debian 6. Now that we have our system installed, we are going to get to know it a little more thoroughly, explaining some basic commands that, in reality, are used for any distribution.

D4ny R3y is one of the Winners from our weekly competition: «Share what you know about Linux«. Congratulations Dany!

Introduction

A computer equipment consists of physical devices called globally hardware, and logical components called software. There are tools that allow identifying both parts, either to know the characteristics of the equipment and to measure its performance and / or diagnose possible failures.

When there is a need to request support in solving problems, it is important to be able to provide all the information that is possible and necessary about the hardware and software that make up the equipment. In that sense, this article can be seen as an expansion of an older one in which we explained where the system log files are located.

Justification

When looking for answers to the problems you may face when using Linux, it is necessary to provide all the necessary information about the problem in question, such as: the type of computer you have, Debian version, kernel version, desktop system , etc. This will help describe the steps you took to cause or fix the problem.

Related article:
Enable root user in Ubuntu

It's easier to request and get support when you know how to provide such information, and this article is intended to provide a list of commands to achieve that goal. Many new Debian GNU / Linux users do not know how to provide as much information as possible and may not receive adequate help simply because they do not know how to provide the appropriate information.

Conventions

In some commands the resulting information exceeds the height of the screen, so to facilitate the reading of this information, the less pager is used and in this way it is possible to scroll down and up, displaying all the information. To exit the pager, simply press the Q (quit) key. Here are 2 examples of how this pager will be used:

dmesg | less

y

less /etc/apt/sources.list

Manufacturer and model information

Equipment manufacturer:

sudo dmidecode -s system-manufacturer

Product name:

sudo dmidecode -s system-product-name

Product version:

sudo dmidecode -s system-version

Equipment serial number:

sudo dmidecode -s system-serial-number

SKU (Stock Keeping Unit) or P / N (Part Number) of the product:

sudo dmidecode | grep -i sku

More detailed information:

sudo dmidecode




Related article:
Permissions and rights in Linux

Processor information

Show manufacturer name, model, and speed:

grep 'vendor_id' / proc / cpuinfo; grep 'model name' / proc / cpuinfo; grep 'cpu MHz' / proc / cpuinfo

Show architecture (32 or 64 bit):

sudo lshw -C CPU | grep width
Note: The lshw package is not installed by default, so installation is required before using it.

Show machine type:

uname -m

Show if the processor supports "Virtualization Extensions" (Intel-VT or AMD-V), which are activated from the computer's BIOS configuration:

If the processor is Intel, you need to know if the value "vmx" appears:

grep -i vmx / proc / cpuinfo

If the processor is AMD, you need to know if the value "svm" appears:

grep -i svm / proc / cpuinfo

Battery info

acpi -bi

ó

acpitool -B
Note: the acpitool command is not installed by default.

RAM memory and SWAP partition

Show total RAM and swap partition (change last parameter to: -b = Bytes, -k = Kilobytes, -m = Megabytes, -g = Gigabytes, as appropriate):

free -o -m

and another way to do it is like this:

grep 'MemTotal' / proc / meminfo; grep 'SwapTotal' / proc / meminfo

To show what partition (and size) the swap is on:

sudo swapon -s

Kernel

Show kernel name and version:

uname -sr

Shell

Show the shell in use:

echo $ SHELL

Distribution

Show the name, version and key name of the distribution:

lsb_release -idc

User environment

Current user name:

echo $ USER

Name of the team:

echo $ HOSTNAME

Current user base directory:

echo $ HOME

Current working directory:

echo $ PWD

o

pwd

Hardware

List PCI / PCIe devices

lspci

List all PCMCIA devices

/ sbin / lspcmcia

List all USB devices:

lsusb

List all devices detected as SCSI:

lsscsi
Note: The above package is not installed by default, so it is necessary to install it before using it.

Modules that have been instructed to the kernel to load during boot:

cat / etc / modules

List all modules that the system loaded:

lsmod | less

List the hardware (summary information):

sudo lshw -short

List the hardware (extensive information):

sudo lshw | less
Note: The lshw package is not installed by default, so installation is required before using it.

Storage and boot media

List the partitions on the storage media:

sudo fdisk-l

Know the used and available space in the partitions:

df -h

Know what partition (and size) is swap on:

sudo swapon -s

Show the entries logged for the GRUB "Legacy" bootloader (up to version 0.97):

sudo grep -i title /boot/grub/menu.lst | grep "#" -v

Show the logged entries for the GRUB 2 bootloader:

sudo grep -i menuentry /boot/grub/grub.cfg | grep "#" -v

Show the partition table (File System TABle) that the system mounts automatically during startup:

less / etc / fstab

Show the UUID (Universally Unique IDentifier) ​​value of all partitions:

sudo blkid

Social

List the wired PCI network devices:

lspci | grep -i ethernet

List the PCI wireless network devices:

lspci | grep -i network

List USB network devices:

lsusb | grep -i ethernet; lsusb | grep -i network

Show the modules loaded by the system, to control wireless network cards:

lsmod | grep iwl

Show information about the driver used by a specific network device (the word interface should be replaced by the logical name of the network card, for example eth0, wlan0, ath0, etc.):

sudo ethtool -i interface
Note: The above package is not installed by default, so it is necessary to install it before using it.

Configuration of the network cards and their assigned IP addresses:

cat / etc / network / interfaces

Resolution of Domain Names:

cat /etc/resolv.conf

Show the contents of the HOSTS file:

cat / etc / hosts

Computer name, as it will be seen on the local network:

cat / etc / hostname

ó

grep 127.0.1.1 / etc / hosts

ó

echo $ HOSTNAME

Local IP addresses of the wired network cards (summary):

/ sbin / ifconfig | grep -i direc | grep -i bcast

if the system is in English, use:

/ sbin / ifconfig | grep -i addr | grep -i bcast

Local IP addresses of the wired network cards (detail):

/ Sbin / ifconfig

Local IP addresses of wireless network cards (summary):

/ sbin / iwconfig | grep -i direc | grep -i bcast

if the system is in English, use:

/ sbin / iwconfig | grep -i addr | grep -i bcast

Local IP addresses of the wireless network cards (detail):

/ Sbin / iwconfig

Show the routing table:

sudo route -n

To find out the public (external) IP address:

curl ip.appspot.com

Repositories / system update

View the content of the sources.list file, which contains the addresses of the repositories:

less /etc/apt/sources.list

Video

List the video cards (PCI / PCIe):

lspci | grep-i vga

To determine if the computer supports graphics acceleration, the mesa-utils tool package must be installed. This package contains the glxinfo command:

glxinfo | grep -i render

To calculate the FPS (frames per second), execute the following command:

timeout 60 glxgears

Which will show for 60 seconds (with the help of the timeout command) a small window with an animation of 3 gears, while at the same time in the terminal window the average values ​​of frames per second (FPS, frames per second) will be shown. ):

Example of the graphical performance of a system:

338 frames in 5.4 seconds = 62.225 FPS
280 frames in 5.1 seconds = 55.343 FPS
280 frames in 5.2 seconds = 54.179 FPS
280 frames in 5.2 seconds = 53.830 FPS
280 frames in 5.3 seconds = 53.211 FPS
338 frames in 5.4 seconds = 62.225 FPS
280 frames in 5.1 seconds = 55.343 FPS
280 frames in 5.2 seconds = 54.179 FPS
280 frames in 5.2 seconds = 53.830 FPS
280 frames in 5.3 seconds = 53.211 FPS

Example of better graphics performance on another system:

2340 frames in 5.0 seconds = 467.986 FPS
2400 frames in 5.0 seconds = 479.886 FPS
2080 frames in 5.0 seconds = 415.981 FPS
2142 frames in 5.0 seconds = 428.346 FPS
2442 frames in 5.0 seconds = 488.181 FPS
2295 frames in 5.0 seconds = 458.847 FPS
2298 frames in 5.0 seconds = 459.481 FPS
2416 frames in 5.0 seconds = 483.141 FPS
2209 frames in 5.0 seconds = 441.624 FPS
2437 frames in 5.0 seconds = 487.332 FPS

To display the current X (X Window System) server configuration:

less /etc/X11/xorg.conf

To find the current resolution (width x height) and sweep frequency (MHz):

xrandr | grep '*'

To know all the resolutions that the current configuration supports:

xrandr

To display the webcams (USB):

lsusb | grep -i camera

The following example shows the result of 2 webcams connected to the same computer:

Bus 001 Device 003: ID 0c45: 62c0 Microdia Sonix USB 2.0 Camera
Bus 002 Device 004: ID 0ac8: 3420 Z-Star Microelectronics Corp. Venus USB2.0 Camera
Webcams are "mounted" in consecutive order on the / dev / path:

Bus 001 -> / dev / video0
Bus 002 -> / dev / video1
Bus 003 -> / dev / video2
[…] To check that the webcams have been "mounted" in their corresponding path:

ls / dev / video * -lh

Audio

List audio hardware:

lspci | grep -i audio

ó

sudo lshw | grep -i audio | grep product
Note: The above package is not installed by default, so it is necessary to install it before using it.

List the audio playback devices:

aplay -l | grep -i card

if the system is in English then it is used:

aplay -l | grep -i card

List all the modules that the system loaded, to be used by the sound devices:

lsmod | grep -i snd

The following are tests to verify if the speakers are properly connected and distributed. The speakers should be turned on and during the test the volume, cables, and layout can be adjusted. Each test emits a sound in a cycle, and is repeated 2 more times:

If the sound system is 1 channel (monaural):

speaker-test -l 3 -t sine -c 1

If the sound system is 2-channel (stereo):

speaker-test -l 3 -t sine -c 2

If the sound system is 5.1 channel (surround):

speaker-test -l 3 -t sine -c 6

Registers (logs)

Display the last 30 lines of the kernel buffer:

dmesg | tail -30

View the entire kernel buffer:

dmesg | less

The X server logs give useful information about the current configuration of the server, and about the video card:

cd / var / log / ls Xorg * -hl

this will display all the log files from the X server, with the Xorg.0.log file being the most recent.

To view the error messages (errors) and warning messages (warnings):

grep -E "(WW) | (EE)" Xorg.0.log | grep -v unknown

If you want to see all the registry information:

less Xorg.0.log

If you want to see the content of a record prior to the current one, just replace the file name Xorg.0.log with the name of the file you want to view.

To view the boot record, it is necessary to activate it first. Open the / etc / default / bootlogd file and replace the value no with yes, looking like this:

# Run bootlogd at startup? BOOTLOGD_ENABLE = yes

During the next system startup the file / var / log / boot will be generated, which can now be reviewed:

sudo less / var / log / boot

Previous boot records can be viewed with:

sudo ls / var / log / boot * -hl

and be consulted as already shown.

To see other logs: Most of the system logs are found in the / var / log / directory, as well as in several subdirectories, therefore, just enter that directory and make a list to know them:

cd / var / log / ls -hl

Other ways to know the system

Although there are also graphical tools that allow us to know the system, it is possible that the graphical environment does not work, therefore the use of the terminal is essential. Some of the most popular graphical tools are hardinfo and sysinfo, and to install them from the terminal, just run:

sudo aptitude install hardinfo sysinfo
Note: hardinfo appears as System Profiler and Benchmark, and sysinfo appears as Sysinfo.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

61 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Daniel pedroza said

    good idea!!!
    I think I will also make a conky, it will be like my project to learn how to develop for linux! 🙂

  2.   Cuauhtemoc said

    very good, basic but very good

  3.   Rodrigo Quiroz said

    Dear, excellent article, thank you very much for sharing your knowledge !!!!!!!!

  4.   joao patiño said

    It has been a long time since I found such a complete and explained post with such a broad topic, you dedicated time to it. Excellent

  5.   Lito Black said

    Yesiiiii. I've wanted something like that for a long time.

    Thank you.

    1.    KZKG ^ Gaara said

      For a long time I wanted to document everything I have done on the DesdeLinux servers, but unfortunately my free time is very little.
      Thanks for the comment 🙂

  6.   Nicolas Cerda said

    Very good guide, he got me out of trouble.

  7.   Angel said

    I had no sound in Ubuntu 12.04, I have updated what I have known and now I get a screen that asks me for the username and password (so far fine) But then continue with this question: system product-name: ~ $
    and here I did not know what to put, with what this post says I will try to continue, thanks

    1.    jostin said

      If the audio doesn't work for you, try this command:
      systemctl –user enable pulseaudio && systemctl –user start pulseaudio
      With this your problem should disappear. When I installed kali linux the same thing happened to me and with this command I already had sound.

  8.   marko said

    excellent blog he¡¡¡¡¡ definitely linuxx is great …………… ..

  9.   marko said

    …………..

  10.   Alfonso said

    Thanks a lot! I am glad that there are people like you who are willing to help others and against selfish, monopolistic and capitalist ideals, just for the sake of using Linux. We are community, and like everyone we seek freedom. This is why we use Linux. 🙂 Love Unix!

    1.    let's use linux said

      You're welcome! Hug! Paul.

  11.   Siddhartha Buddha said

    It was left to comment that the information in this article was originally published on kubuntu-es.org in May 2009:

    http://siddharta.kubuntu-es.org/5214/como-conocer-sistema-comandos-obtener-informacion-que-permita-diagnosticar-pr

    http://www.kubuntu-es.org/wiki/comenzando/howto-conociendo-sistema-o-como-cumplir-punto-6-normas-foro

    and was later replicated on esdebian.org in November 2010:

    http://www.esdebian.org/wiki/comandos-conocer-sistema-identificar-hardware-algunas-configuraciones-software

    Of course, just by publishing something on the Internet it is understood that it is for your use; I am only saying that it was necessary to indicate the original origin of this publication.

    Regards,
    Sidd.

    1.    elav said

      Hello Siddharta, I remember you from esDebian 😉

      This article was published over a year ago on UsemosLinux when it was hosted on BlogSpot. Pablo was not even its author, but the collaboration of someone else. However, you are right, and we will put the source in the FromLinux article.

      Thanks for stopping by.

      1.    Rolo said

        «… D4ny R3y is one of the winners of our weekly competition:“ Share what you know about Linux “. Congratulations Dany!… »
        lol the guy earned a badge for making a popy & paste haha
        citing the source is when one takes something from an article but this is a verbatim copy. I remember an art. of huayra that they deleted for being a copy, not long ago

    2.    let's use linux said

      Sorry for that ... it has already been corrected. As elav said, the reader who shared the news did not specify its source, so we assumed it was original.
      Hug! Paul.

    3.    Robert said

      And it should be noted that it comes from the linux manual that was created by the linux author when he copied it from unix.

  12.   Siddhartha Buddha said

    @elav: hey, how long! How nice to see you in these parts. I will try to update myself on your new routes, and I will surely find interesting and useful things here 🙂

    @Pablo: I apologize, because no matter how hard I searched, I did not find any other reference to the author other than your mention, and for that reason I commented on esdebian.org that it was surely an accidental omission. Reciprocal hugs 🙂

    Sidd.

  13.   Javier said

    Very complete article.

  14.   Pablo said

    Excellent info all together ...
    Very good post.
    I would also like one for network administrators, see system log, see machines with network viruses, possible attacks, etc.

  15.   Angel said

    When starting kubuntu 13.04 after entering the password, the screen goes dark. But if I enter the guest session, no. I do not know what to do.
    Regards. Angel

    1.    let's use linux said

      Hello Angel! The truth is that I have no idea what could be happening. I'm sorry.

  16.   Diego Olivares placeholder image said

    Thanks so much! it has been very useful.

  17.   Pablo Ivan Correa said

    Basic, for any user who wants to know how his #Linux and his #Pc work

  18.   Fabio Isàziga said

    These tutorials for inexperienced like me are great. well detailed and very understandable. Thank you

  19.   Fabiola said

    Hey.
    I have a Squid and I need to send me the SARG graph per hour, investigating I found that it is possible with the command "crontab", but the truth is I did not understand very well.

    regards

  20.   Daxwert said

    Thanks for this information, it is very complete.

  21.   Nahu said

    Excellent post! Thanks a lot!

  22.   gabondyle said

    Grateful for all this information. The difficult thing is that it stays all in the head, there are several commands, but what a great guide. GNU / Linux gives us so much… ..

  23.   Ghermain said

    Thank you very much, it has helped me to know more about my machine and what I have installed.

  24.   Larry diaz said

    I am not writing comments, but this information is worth it. Thanks, it helped me not to disassemble my CPU, an old machine with a PCChips p21 board that runs xubuntu.

    1.    let's use linux said

      You're welcome, man! I send you a hug and thank you for leaving your comment.
      Pablo.

  25.   sonia said

    Is this correct :::

    How to search / tmp for all files containing the name
    JOSUE in all subdirectories and say those that contain the
    String Maximum

    find /tmp.* –name JOSUE –L

  26.   sonia said

    4.- Kill all nano processes, or that contain the word nano,
    also simply see the processes of the ericssondb webservice like this
    you could validate that a webservice process or any process is
    running, in the output you will see the time, and more details

    killoall nano
    ps | grep ericsondb
    ps | grep nano
    is it correct ??????

  27.   nacho20u said

    very good

  28.   erwin giraldo said

    Excellent compa, thanks for sharing your knowledge.

    Keep sharing, where else do you have a post? On YouTube?

    I want to set up a Zentyal server, do you know something?

    Greetings, Colombia-Bogota

  29.   Juan Cuevas Moreno said

    Thanks for the info, for me that I want to learn about this great operating system and that I declare myself ignorant in many aspects is a great help.

  30.   James said

    Excellent, tutorials like this are the ones that help us understand and know what we have in front of us.
    You have worked very well.
    Thank you very much, you have earned a follower.

    1.    let's use linux said

      Thanks, Jaime! a hug! Paul.

  31.   Mr. Rabbit said

    This is a question from a complete beginner:
    With what command do root start?

    1.    let's use linux said

      How to log into a terminal with administrator privileges? Easy.
      You can run

      his -

      Or, if you have sudo configured, you can directly execute any command with administrator privileges using "sudo" on the front. For example:

      sudo firefox

  32.   Miguel said

    Could you include some commands to know what window manager we have? lxde openbox and all that section. thanks.

  33.   Tomas Ramirez said

    Excellent contribution brother

    1.    let's use linux said

      You're welcome! Hug!
      Paul

  34.   Hoover Campoverde said

    I am very grateful friend for uploading and sharing this great work.

    I am new to Ubuntu, and I would like to learn all about this powerful operating system.

    I love working on the console more.

  35.   Marcelo KAZANDJIAN said

    Excellent summary of very useful commands and that we frequently leave them lost among several thousand files and that when we need them we must google to remember them.
    Excellent A ++

  36.   Marco said

    I really like this very simple but complete post.

  37.   diego said

    Excellent information, thank you. Added to favorites!

  38.   Oscar Ramirez said

    Dear Opensuse friends:
    I need your help, I tell you that I am very new to this operating system and I have encountered a couple of difficulties to have the computer to the maximum, the characteristics of the equipment are the following:
    Brand: Toshiba
    Processor: Genuine Intel (R) CPU T1350 @ 1.86GHz
    Architecture: 32 bit
    Distribution:
    Distributor ID: openSUSE project
    Description: openSUSE 13.2 (Harlequin) (i586)
    Codename: Harlequin

    I have a Huawei mobile internet, the problem is that it identifies me as USB not as mobile internet and so far I have not been able to install it, I would appreciate your help, by the way the USB has some files to install it but I could not run them and it gives me the message of: «There was a problem running this program. The program cannot be found », nor can I tell them which USB model I have because I don't know how to do it.
    I thank you in advance

    1.    let's use linux said

      Hello! First of all, sorry for the delay in answering.
      I suggest you use our Ask From Linux service (http://ask.desdelinux.net) to carry out this type of consultation. That way you can get the help of the entire community.
      A hug! Paul

  39.   river said

    Thanks for the info, it has been very useful for me to know the serial number of the machine since I was asked by an exe program that was running in wine and the Good branch of the blog had tied me. Salu2 from Argentina

    1.    let's use linux said

      You're welcome!
      A hug, Pablo.

  40.   Danny said

    Please add the following command to the RAM Memory section as it shows the type of DDR memory it is, its frequencies and the available banks (slots), which is used when changing or increasing a memory card:
    dmidecode –type 17
    Greetings and excellent post. It has been very useful to me.
    Thank you!

  41.   Apeiron0 said

    I had never commented in the three years that I have known them, but this time I do it to thank these entries, they are from 2012 and 2016 they have served me a lot.
    Thank you.

  42.   rafael said

    Thank you very much, very good, these are commands that are not used daily, this is useful to keep it well at hand because they are easy to forget

  43.   Ignacio said

    Thanks for so much and good information

  44.   kross said

    thank you very much for sharing the knowledge

  45.   what happen to Lupita said

    You can modify the manufacturer's information, the serial number and the model
    as if to blur the information, when you connect to a fiber optic converter to make direct tests to your link, the isp knows which brand and which model was connected and has all the equipment information
    And I am a security maniac (key to bios key of grub disk encrypted with its respective key. 28 setbacks repaired, and 70 seconds repaired and more home key) I am worried that someone knows how to modify manufacturer information greetings thanks

  46.   Carlos Zarzalejo Escobar said

    I want to be informed.

  47.   Martin said

    EXCELLENT, thank you very much, it was really helpful to me, I would like to be able to have computer skills to help people in this way.