Linux command line hardware information. Getting information about hardware in Linux

Not all users remember by heart the components of their computer, as well as other system details, so the ability to view system information in the OS must be present. Platforms developed in Linux also have such tools. Next, we will try to talk in as much detail as possible about the available methods for viewing the necessary information, taking as an example the latest version of the popular Ubuntu OS. In other Linux distributions, this procedure can be carried out in exactly the same way.

Today we offer you to familiarize yourself with two different methods for finding the required system information. Both of them work on slightly different algorithms and also have a different concept. Because of this, each option will be most useful to different users.

Method 1: Hardinfo

The method using the Hardinfo program is suitable for novice users and all those who do not want to get involved with working in "Terminal". However, even the installation of additional software is not complete without launching the console, so you will have to turn to it for one command.

  1. Run "Terminal" and enter the command sudo apt install hardinfo there.
  2. Enter your password to confirm root access (the characters you enter will not be displayed).
  3. Confirm adding new files by selecting the appropriate option.
  4. All that remains is to run the program through the hardinfo command.
  5. A graphics window will now open, divided into two panels. On the left you see categories with information about the system, users and computer. Select the appropriate section and a summary of all data will appear on the right.
  6. Using a button "Create report" you can save a copy of the information in any convenient form.
  7. For example, a ready-made HTML file can then be easily opened through a standard browser, displaying the PC characteristics in text form.

As you can see, Hardinfo is a kind of collection of all commands from the console, implemented through a graphical interface. That is why this method greatly simplifies and speeds up the process of finding the necessary information.

Method 2: Terminal

The console built into Ubuntu provides unlimited possibilities for the user. Thanks to commands, you can perform actions with programs, files, manage the system, and much more. There are utilities that allow you to find out information of interest through "Terminal". Let's look at everything in order.

  1. Open the menu and launch the console, you can also do this by holding down the key combination Ctrl + Alt + T.
  2. To get started, just enter the hostname command, and then click on Enter to display the account name.
  3. Laptop users also often struggle with the need to determine the serial number or exact model of their device. Three commands will help you find the information you need:

    sudo dmidecode -s system-serial-number
    sudo dmidecode -s system-manufacturer
    sudo dmidecode -s system-product-name

  4. To collect information about all connected equipment, you cannot do without an additional utility. You can install it by typing sudo apt-get install procinfo .
  5. Once the installation is complete, type sudo lsdev .
  6. After a short scan you will get a list of all active devices.
  7. As for the processor model and other information about it, the easiest way to do this is cat /proc/cpuinfo . You will immediately receive everything you need to familiarize yourself.
  8. We smoothly move on to another very important detail - RAM. Less /proc/meminfo will help you determine the amount of free and used space. Immediately after entering the command, you will see the corresponding lines in the console.
  9. More condensed information is provided as follows:
    • free -m — memory in megabytes;
    • free -g - gigabytes;
    • free -h - in a simplified readable form.
  10. Swapon -s is responsible for the swap file. You will be able to find out not only about the very existence of such a file, but also see its size.
  11. If you are interested in the current version of the Ubuntu distribution, use the lsb_release -a command. You will receive a version certificate and find out the code name with a description.
  12. However, there are additional commands that allow you to obtain more detailed information about the operating system. For example, uname -r displays the kernel version, uname -p displays the architecture, and uname -a displays general information.
  13. Type lsblk to see a list of all connected hard drives and active partitions. In addition, a summary of their volumes is also displayed here.
  14. To study the disk layout in detail (number of sectors, their size and type), you should type sudo fdisk /dev/sda , where sda— selected drive.
  15. Typically, additional devices are connected to the computer via free USB connectors or via Bluetooth technology. Viewing all devices, their number and ID is done using lsusb.
  16. Write lspci | grep -i vga or lspci -vvnn | grep VGA to display a summary of the active graphics driver and video card in use.

Of course, the list of all available commands does not end there, but above we tried to talk about the most basic and useful ones that may be useful to the average user. If you are interested in options for obtaining specific data about the system or computer, please refer to the official documentation of the distribution you are using.

You can choose the most appropriate method for searching for system information - use the classic console, or use a program with a graphical interface. If your Linux distribution has any problems with software or commands, carefully study the error text and find a solution or tips in the official documentation.

If you have a need to find out what is hidden from your eyes inside a computer running Linux (we will consider methods that work in Linux Mint and Ubuntu), then doing this is no more difficult than in Windows, and sometimes even easier. There are several methods for this, which we propose to consider in this article.

Let's start with the most familiar method for the average user, inexperienced with all the delights of the Linux OS. Let's imagine that you switched to Linux relatively recently, and have not yet completely weaned yourself from the Windows you are used to.

In Windows, to find out detailed information about the hardware, users usually use special programs, for example AIDA64 and similar ones. We assure you that Linux is not deprived in this regard. It may not have such a variety of similar programs, but there will definitely be those that will provide you with a complete report on the configuration of your computer.

One such program is HardInfo (after installation it appears in the menu as System Profiler and Benchmark). Using this utility, you can get the most complete picture of the computer hardware that is hidden from you. You can install it from the repository of your distribution.

HardInfo program in Linux Mint 18 Sarah Mate

The program presents in an accessible graphic form the main points on which you can obtain information. You just need to click on the desired icon and the program will display the main characteristics of the system.

HardInfo. Information about the memory installed in the computer.

The program also allows for the creation of a report in html format, which you can then view in a browser. To do this, you need to click “Generate Report”, select the items for which you want to see a report and wait for the result.

HTML report generated in the HardInfo program.

Despite all its advantages, the HardInfo program provides poorer results than what you will get when using the terminal and a few commands.

First, let's look at the utility lshw To install it, you need to enter in the terminal: sudo apt-get install lshw After installation, in order to find out the system characteristics, just enter the command in the terminal sudo lshw

Result of sudo lshw command in terminal.

As you can see, the list is very long. To shorten it, you can enter the command sudo lshw -short The list will be shorter and more compact.

Result of sudo lshw -short command in terminal.

There is also another variation of this command that will allow you to view the full list, but at the same time you will load it as needed: sudo lshw|more

This is what the result looks like after entering the command in the terminal sudo lshw|more (now you only need to press the Enter key and read the information displayed).

To generate a report in html format you need to enter the command lshw -html > hardware.html (in this case, the report will be saved to the user’s folder - the one where the Downloads, Music, etc. folders are located).

It should be mentioned that the system has a /proc/ folder, which also contains information about the hardware of your computer. As an example, here are several related commands that, when typed in the terminal, will display the information we are interested in:

cat /proc/cpuinfo- will display information about the processor

cat /proc/meminfo— displays information about RAM

cat /proc/partitions— displays information about hard disk partitions

We hope that this information will help you lift the veil of secrecy about the inner world of your Linux PC.

How to find out the characteristics of a computer in Linux? updated: January 21, 2017 by: Maxim Ivanov

Let's look at several useful commands and utilities that can be used to get information about hardware in Linux. This need arises, for example, when you need to install a driver for some computer device and you need to know its exact name. Or, for example, you want to get information about the memory occupied or computer resources.

Processor information (CPU)

You can get all the necessary information about the central processor in Linux by running the command in the terminal:

Cat /proc/cpuinfo

To determine whether your processor is 32-bit or 64-bit, you need to look at the flags that are indicated in the command output. If among the flags there is lm(long mode), this means that your processor is 64-bit. For example, when executing the command cat /proc/cpuinfo we can get the following flags:

Flags: fpu vme de acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon ...

Information about PCI devices (video card information)

Using the command lspci You can display all information about PCI devices:

This command is often used to get information about a video card. Since the command output lspci is large enough, then you can use the command grep to set the search condition. For example, if we know that we have a video card from Nvidia, then we can use the command:

lspci | grep nVidia

And as a result you get something like:

01:00.0 VGA compatible controller: nVidia Corporation G72M (rev a1)

Please note that the grep command is case sensitive and therefore, if you do not find what you were looking for the first time, you should try a different spelling, for example, nvidia, NVIDIA or simply idia. Similarly, you can look for information in the output of any other commands by adding to the command: " | grep search-string.

Information about the driver version for Nvidia video cards in Linux can be obtained by running:

Cat /proc/driver/nvidia/version

Random access memory (RAM) information

To get information about the volume, as well as the amount of free and used RAM, you can use the command:

Free -t -m

Information about virtual memory can be obtained with the command vmstat:

If you need more detailed information about the processes occupying RAM and processor (CPU) load, then you can use the Top or htop utilities. The top utility is usually always present in Linux. To run it, simply run:

Hard drive information

Information about hard drive partitions in Linux:

Sudo fdisk -l

Information about mounted partitions, amount of free and used memory:

There is another useful command du, which displays information about the size of each file in the current and subdirectories. If you want to get information about all files in the current directory, run the command without parameters:

You can set the file name as a parameter, for example, to find out the file size abc.bin do:

Du abc.bin

Information about USB devices and USB buses

To display information about USB buses and connected USB devices, use the command lsusb:

Non-console programs

Let's look at several graphic programs that will help when working with equipment.

The Gnome desktop environment includes a graphical utility called System monitor. It displays information about CPU usage, running processes (applications), information about hard drives, and also displays graphs, including network usage. You can run it from the command line by running:

Gnome-system-monitor

To work with hard ones, you can use the GParted program.

Additional Information

Finally, it’s worth mentioning a very important team lshw, which displays almost all the information about your computer. Team lshw need to run as root user:

Sudo lshw

To display brief information, use the key -short:

Sudo lshw -short

You can get more detailed information about the commands described in this article by using the Linux help system. To do this, you need to run in the console:

Man command-name

For example, to get all the information about a command du, run the command.

Beginners in the world of Linux are often faced with the question of how to find out all the information about the installed system, hardware and supported functions. Yes, it will be difficult to find a utility a la “Windows Device Manager” =) In fact, you can find programs that allow you to find out all the information about the system, but it is easier, in my opinion, to find out all this directly in the console. Sometimes you need to briefly present “general” information about the system. The commands below generate the output of such data in the about_system.txt file in your “Home folder”. Brigades have been converted to the type “for use in the terminal”.

It is possible to execute the entire block of commands at once, or separately. What each command outputs is indicated in the comment to any line on the right. This video shows the teams and results of several utilities, with the help of which you can find out comprehensive information about the equipment and its presence in Linux systems. The tools were tested in Debian 8. In Ubuntu or Linux Mint everything will work similarly. It should also work in Fedora or OpenSuse. Please write in the comments if anything is different.

lshw – Learn about all computer hardware in detail. dmidecode – data from the DMI table (also called SMBIOS). With the -t parameter it is possible to limit the output to the desired type (bios, system, baseboard, chassis, processor, memory, cache, connector, slot). An example of information about RAM slots (all of them, simply if dies are not installed in them) can be found out like this:

dmidecode -t memory

cat /proc/cpuinfo – processor
cat /proc/meminfo – operational memory and swap file (free - shorter information)
fdisk -l or df – hard disks and their partitions. fdisk will also show the number of cylinders, sectors, etc.
lspci – a list of all PCI devices, sometimes including USB (lsusb is an expert command)
lspci or grep Audio – card game audio driver
lsmod – loaded kernel modules
lsusb – list of all usb devices (including built-in ones, such as webcams, etc.)

Collecting system data using HardInfo

In Windows, in order to find out detailed information about the hardware, users usually use special programs, for example AIDA64 and similar ones. We assure you that Linux is not offended in this regard. It may not have such a variety of similar programs, but there are literally those that will provide you with a complete report on the configuration of your PC. One of these programs is HardInfo (after which the devices are displayed in the menu as System Profiler and Benchmark). With the support of this utility, you can get the most complete picture of the hardware “stuffing” of your computer that is hiding from you. You can install it from the repository of your distribution.

The program presents in an accessible graphic form the main points on which you can obtain information. You just need to click the mouse on the desired icon and the program will display the main characteristics of the system. The program also allows for the creation of a report in html format, which you can then view in a browser. To do this, you need to click “Generate Report”, select the items for which you want to see the report and wait for the result. Despite all its advantages, the HardInfo program provides poorer results than what you will get from using the terminal and a few commands.

Linux system information from ssh console

Very often there is a need to find out this or that information about the system or computer. This can be done in just a couple of lines in the Ubuntu terminal. The Ubuntu GUI has a hardinfo package that shows quite a lot of information about the hardware and software of the computer. But this is a GUI that can be used if a graphical shell is installed on the computer, but the graphical environment, for example, on the server version is missing. And the computer itself may be located somewhere so that your hands cannot reach it) If you want a beautiful window, but the computer is far away, you can forward the hardinfo window via ssh:

uname -a
cat /etc/issue

rpm -qa and analogues

cat /proc/cpuinfo
cat /proc/meminfo
lspci
lsusb

To get started, here is the lshw utility. To install it, you need to run it in the terminal: sudo apt-get install lshw After the devices, in order to find out the system characteristics, just enter the command sudo lshw in the terminal

lshw - this team provides complete information about the hardware of a PC or laptop.

linuxinfo
cat /proc/cpuinfo
free
df -m
and for dessert

less /boot/config-2.6."uname-a"
hwinfo

Linux Ubuntu System Data Collection

In this post I will tell you how to view information about the system, find out what processes (programs) are running, and what kind of overload they create on the computer. And also how to quickly find files and folders on the system when you need to clear disk space. In order to view all information about the computer and the system in Windows, you need to install the Aida64 program. We looked at how to do this in our article How to get complete information about computer mechanisms using Aida64!

Collecting all the intelligible information about the Ubuntu system and hardware can be useful if you have a new computer or laptop, and you are wondering what kind of equipment is there. This can also be useful if you need to replace any component, for example, a hard drive. Or even just like that. To replace equipment, you need to know all the information in advance. You may also need information about Ubuntu hardware if you are setting up Wifi, Bluetooth, a webcam, or installing drivers for a video card. In this article I will list the commands that can be used to obtain information about the Ubuntu operating system. All teams have been tested on Ubuntu 16.04, but they should work on any modern distribution such as Debian, Fedora, OpenSUSE, etc. Linux processor data is also readily available:

cat /proc/cpuinfo

processor: 0
vendor_id: AuthenticAMD
cpu family: 16
model: 6
model name: AMD Athlon(tm) II X2 250 Processor
stepping: 3
microcode: 0x10000c8
cpu MHz: 2300.000

Linux system data using hwinfo command

hwinfo - this utility provides an abundance of information about components: processor, motherboard, operational memory, video card, hard drive, etc. Unfortunately, it is not present in absolutely all distributions, but establishing another case of something is as easy as shelling pears:

- in Debian, Ubuntu: sudo apt-get install hwinfo

- in Fedora and Red Hat: yum install hwinfo

To display basic information, use the -short switch.

This small list of commands will allow you to quickly find out all the necessary information about your system. Using this list of basic commands, you can easily look at and find out basic information about your PC and operating system. We looked at information about the system, running processes (programs). And in addition, we figured out how to work with the Atritoren Usage Analyzer program. And if you have any unclear questions about this content or have any suggestions, please write them in the comments.

You may need to collect all available information about the Ubuntu system and hardware if you have a new computer or laptop and you are wondering what exactly the equipment is. This may also be necessary if you need to replace a component, for example, a hard drive. Or even just like that. To replace equipment, you need to know all the information in advance. You may also need information about Ubuntu hardware if you are going to set up Wifi, Bluetooth, a webcam or install drivers for a video card.

In this article, I will list the commands that can be used to obtain information about the Ubuntu operating system. All commands have been tested on Ubuntu 16.04, but they should work on any modern distribution such as Debian, Fedora, OpenSUSE, etc.

Find out the host name

The easiest way to find out the hostname of your machine is with the hostname command:

cat /etc/hostname

If you have a server, you can look at the domain name of the host determined by DNS:

The host's fully qualified domain name (FQDN) can be viewed with the command:

server01.site

Find the manufacturer, serial number

If you have a laptop, you can get information such as manufacturer, serial number, and other information about Ubuntu hardware encoded in dmi:

sudo dmidecode -s system-serial-number
$ sudo dmidecode -s system-manufacturer
$ sudo dmidecode -s system-product-name

See all available information with the command:

sudo dmidecode | more

You can also use the lshw command; on some distributions you will have to install it:

sudo lshw | more
$ sudo lshw -short

Information about connected equipment

The command will show all connected equipment, used PCI and USB ports, etc:

Processor Information

Linux processor information is also easily available:

cat /proc/cpuinfo

processor: 0
vendor_id: AuthenticAMD
cpu family: 16
model: 6
model name: AMD Athlon(tm) II X2 250 Processor
stepping: 3
microcode: 0x10000c8
cpu MHz: 2300.000

CPU usage statistics

You can see the processor load with the command:

21:56:27 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
21:56:27 all 18.27 0.33 5.26 2.01 0.00 0.04 0.00 0.00 0.00 74.10

The utility may need to be installed by installing the sysstat package.

Memory information

You can view memory usage statistics in the system with the command:

less /proc/meminfo

MemTotal: 6109876 kB
MemFree: 188544 kB
MemAvailable: 2117964 kB
Buffers: 254120 kB
Cached: 1595932 kB

If you don't need such detailed information, you can get information about Linux using the free command.

Display memory information in megabytes:

In gigabytes:

In readable form:

Swap information

You can see if the swap partition is connected and what size it is with the commands:

Virtual memory information

sudo vmstat
$ sudo vmstat 1
$sudo vmstat 2

Distribution version

The command will show the version and distribution name, as well as some additional information, this is important information about the linux operating system:

Kernel version

The kernel is the most important component of the system. Information about the Ubuntu system, namely the kernel version, is available using the uname command.

uname -r
$ uname -a

Linux dhcppc0 4.1.15-8-default #1 SMP PREEMPT Wed Jan 20 16:41:00 UTC 2016 (0e3b3ab) x86_64 x86_64 x86_64 GNU/Linux

Kernel launch options

cat /proc/cmdline
$sysctl -a | more

System architecture

uname -m
$ getconf LONG_BIT
$arch

Hard drive information

Let's look at the connected hard drives:

fdisk -l | grep "^Disk /dev"

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors

Let's look at the partitions on a specific disk:

fdisk -l /dev/sda

Find out the disk label:

sudo fdisk /dev/sda
$ sudo e2label /dev/sda1
$ sudo cfdisk /dev/sda

Block device information

Block device attributes:

List of all block devices:

Free disk space

Ubuntu system information includes disk information. Display used space of all disks:

df
$df -H
$df-HT

Display file sizes in home folder:

du
$ du /home

Mounted drives

View all mounted file systems:

cat /proc/mount
$mount

SCSI devices

Display parameters of SCSI devices connected to the system:

I/O Statistics:

sudo iostat
$ sudo iostat 2

Information about PCI devices

PCI devices are all devices connected to the computer's motherboard, such as the processor, network card, wireless adapter, and so on. Essentially, you can view Ubuntu hardware by viewing the pci device.

lspci
$lspci -vt
$lspci | grep -i "device"
$ lspci -vvvn| less

USB Information

In addition to PCI devices, there are also external USB devices, such as printers, Bluetooth adapters, mice, and keyboards. This is also important information about your Ubuntu computer.

lsusb
$ lsusb -vt

Information about wireless network adapters

The model and manufacturer of the network adapter can be viewed via lscpi, but more detailed information about the settings and supported functions cannot be found there; there are commands for this:

iwconfig
$ watch -n 1 cat /proc/net/wireless
$wavemon
$ iw list

Video card information

lspci | grep -i vga
$ lspci -vvnn | grep VGA

sudo lshw -class display

NVIDIA graphics card information

If proprietary drivers are installed, information about the video card can be viewed with the command:

This will provide more detailed information about the Ubuntu machine than the normal lspci output.

Information about the ATI Readon video card

For the command to work, the ATI driver must be installed:

Unity version

Audio Device Information

lspci | grep -i audio

cat /proc/asound/cards

Battery status

On a laptop, we may need to see the battery status:

upower -i /org/freedesktop/UPower/devices/battery_BAT0
$ acpi -V

System uptime

uptime

uptime
$ cat /proc/loadavg
$ sudo top
$sudo htop
$ sudo atop

History of shutdowns and reboots

last reboot
$last shutdown

Current RunLevel

RunLevel is the run level in the SysVinit init system.

runlevel
$who -r

Viewing the kernel log

Very useful information about the Ubuntu computer, information about errors and problems is located in the kernel log:

sudo less /var/log/dmesg
$ sudo grep "regx" /var/log/dmesg
$ sudo grep "d" /var/log/dmesg

Loaded kernel modules

sudo lsmod
$ sudo modinfo _____module_name___

Network information

View local IP address and other information about network interfaces:

sudo ip a
$sudo ip
$ sudo ip link ls up
$ sudo ifconfig -a

View only information about the eth0 interface:

sudo ip a show eth0
$sudo ifconfig eth0

View routing table:

sudo ip r
$ sudo route -n
$ sudo netstat -nr

View network bridges:

sudo brctl show
$ sudo bridge link

Information about DNS servers

The addresses of the DNS servers with which the system works are located in the /etc/resolv.conf file:

cat /etc/resolv.conf

System DNS settings are located in the /etc/host.conf file

cat /etc/host.conf

Socket Information

We look at open network and local sockets:

All listening ports:

sudo netstat -tulpn
$ sudo netstat -tulpn | grep LISTEN

Let's look at all TCP sockets:

UDP sockets:

Let's look at the files open in the system:

lsof | more
$lsof | grep something
$ lsof /dev/sda2

Information about services

We look at all running services. In SysVinit:

sudo service --status-all

sudo initctl list

We check whether the service loads automatically:

sudo initctl status service-name
$ sudo initctl status smbd

sudo service service_name status
$ sudo service nginx status

View log files

cd /var/log
$ ls -l
$ tail -f /var/log/filename
$ grep "what_needed" /var/log/filename

Search for a file by name

Using Locate:

locate filename
$ locate passwd
$ locate coursework.doc

Using find:

find (/folder_where_to_search) -name (file_name) -print
$ find /etc/ -name /etc/passwd -print
$ find $HOME -name "*.doc" -print

User Information

less /etc/passwd
$ grep userName /etc/passwd
$ getent passwd

Group Information

less /etc/group
$ getent group
$ grep group_name /etc/group
$ groups username

Password Information

chage -l username
$ change -l root
$ change -l vivek

sudo top
$sudo htop
$ sudo atop
$sudo ps auxwww
$ sudo netstat options
$ sudo iostat
$ sudo mpstat 1
$ sudo sar options

Program tracing

strace -o output.txt /bin/foo
$ strace -p 22254 -s 80 -o debug.nginx.txt

Tracing Library Calls

sudo ltrace /usr/sbin/httpd
$ sudo ltrace /sbin/chroot /usr/sbin/httpd

Process Information

sudo pstree
$sudo pstree | less
$ sudo ps auxwwwm
$ps alxwww
$ps auxwww
$ lsof -b M -n -l

Changing the process priority:

sudo /bin/nice -n -1 process name
$ sudo /bin/nice -n -1 pid
$ sudo renice __priority___ pid

Process CPU usage:

sudo taskset -p pid
$ sudo taskset -p 42