7. View board system information¶
Introduction to the supporting video of this chapter:

《17-Check the information of LubanCat》
https://www.bilibili.com/video/BV1wh4y147LS/
When we buy a new laptop or desktop, we will inevitably check its CPU model, memory capacity, hard disk usage, and so on. For a Linux board, it is actually equivalent to a small computer. Although it may be different from a traditional PC, small but complete. We also hope to check the relevant information of the board.
Most of the content introduced in this chapter is not only applicable to the board, but also applicable to the Ubuntu system in the development host. Please try to execute related commands on the two platforms to view the information and compare the differences.
7.1. Preliminary exploration of the /proc directory¶
Linux does not provide a Windows-like task manager, but it records system running information in files under the /proc directory, and users can obtain corresponding system information by accessing files in this directory.
Please execute the following command on the terminal of the board to view the contents of the /proc directory:
1 2 | #Execute the following command on the terminal of the board
ls /proc
|

The information contained in each file in this directory is shown in the table below.
Table /proc file structure
File name |
Function |
---|---|
pid* |
“pid*” is usually a number, which represents the PID number of the process. Each process currently running in the system has a corresponding directory, which is used to record all relevant information of the process. For an operating system, an application is a process. |
self |
This file is a soft link that points to the directory of the current process. By accessing the /proc/self/ directory to obtain the information of the current process, there is no need to obtain the pid every time. |
thread-self |
This file is also a soft link, pointing to the current thread. Accessing this file is equivalent to accessing the content of “current process pid/task/current thread tid”. A process can contain multiple threads, but at least one process is required, and these threads jointly support the operation of the process. |
version |
Records the currently running kernel version, usually you can use the “uname -r” command to view. |
cpuinfo |
Record the CPU provider and related configuration information in the system |
modules |
Records the module information currently loaded by the system |
meminfo |
Record the usage of memory in the system, the free command will access this file to obtain the free and used amount of system memory |
file systems |
Documents the file system types supported by the kernel. Usually when mounting a device. If no file system is specified and it cannot determine the file system type, mount will try the file systems contained in this file, except those marked with “nodev”. |
By accessing the contents of the /proc folder, we can get the system information we want.
7.2. View CPU information¶
The /proc/cpuinfo file stores CPU information, which can be viewed through the following command:
1 | cat /proc/cpuinfo
|

7.3. Check the kernel version¶
The /proc/version file saves the version information of the kernel, which we can obtain through the following command.
1 | cat /proc/version
|

From the figure above, we can see that the currently used kernel version is 4.19.232.
It can also be obtained by the following command:
1 | uname -a
|

7.4. View memory information¶
The kernel records the memory usage in the /proc/meminfo file, and we can read the contents of the file to understand our memory usage:
The following is the case of memory 2GB.
1 | cat /proc/meminfo
|

In practical applications, we generally do not directly read the content of the file, but use the following commands to obtain memory-related information.
Use the free command to view the memory size of the system:
1 | free
|

7.5. Check storage capacity¶
The /proc/partitions file contains the partition information of the memory. You can check the partition information to know the capacity of the onboard FLASH memory.
You can use the following command to view:
1 | cat /proc/partitions
|
The figure below is the command output information using the 32GB eMMC board.

The mmcblk starts with the data blocks belonging to the eMMC memory.
7.6. View task progress¶
Under the /proc folder, there are many folders named after numbers. These folders are used to record the status of currently running processes. The file name is their pid number, and each process corresponds to a pid number for identification. The content contained in these process folders is basically the same. Use the ls command to view the contents of the folder whose pid is 1, as shown in the following figure. Among them, fd records the file description used by the current process, mountinfo records the mount information, and mem records the memory usage of the process, etc.
1 | ls /proc/1
|

In addition to the method used above, the top command is also commonly used. The function of this command is similar to the Windows task manager. The execution effect is shown in the figure above. This command can update the usage of each process in real time. Press the “q” key or “Ctrl + C” to exit the command.
1 | top
|

7.7. View supported file systems¶
/proc/filesystems can be used to view the file system types supported by the kernel, as shown in the figure above. In the figure, some file systems are marked with “nodev” in front of them. Indicates that these file systems do not need to mount block devices, such as network file system nfs/nfs4, pseudo file system sysfs, etc.
1 | cat /proc/filesystems
|

7.8. View the current main frequency of the CPU¶
In addition to the /proc directory, you can also view some system-related information in the /sys directory. For example, the file /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq contains the current main frequency information of CPU0. If the file exists in the system, you can output its content to view:
1 | cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
|

As shown in the output above, it means that the main frequency of CPU0 is 408MHz.
The CPU of LubanCat-RK series boards has the function of frequency modulation. When your load is low, the frequency will be automatically reduced to save energy consumption. When the scene with high load is required, the frequency will be automatically increased to improve performance.
1 | ls -g /sys/devices/system/cpu/cpu0/cpufreq/
|
