The output of the command (Figure 7) can be lengthy, as it displays information for all memory-type devices. So if you don’t have the ability to scroll, you might want to send the output of that command to a file, like so: sudo dmidecode – t 17 dmiinfoI, or pipe it to the less command, as in sudo dmidecode less. Linux check memory usage per process. How to check which process is using more memory in Linux. Linux how much memory is a process using. Linux track process memory usage over time. Linux check memory usage per process in mb. Linux check memory. Linux show memory usage. Linux see memory usage. Linux memory usage info. Linux process memory usage.
Here’s a useful way of finding out how many memory slots are occupied on the motherboard of a machine without removing the cover, as well as how much installed physical memory is supported.
We can use the dmidecode command to reveal your systems DMI table, which contains details of the systems hardware.
There are a whole load of DMI types we can look at – a full table of those at the end of this article.
In this particular case, we are interested in memory – type 16 ‘Physical Memory Array’ will show us how much memory is supported and DMI type 17 will reveal details of currently installed memory.
So, first off:-
dmidecode -t 16
Maximum Capacity shows us the maximum amount of memory can be installed in the machine. Number of devices tells us how many slots there are on the motherboard – in this case, 8.
Now we can interrogotate DMI type 17 – ‘Memory Device’ to show us details of installed memory
dmidecode -t 17
Each module installed will be listed with the the information given above. If we just want to know how many modules are installed and what size they are, we only really need the Size: – so we use grep
dmidecode -t 17 | grep Size
From this we can see that 8x 2048MB modules are installed – so all the slots on the motherboard are populated.
There is plenty of other useful information that can be retrieved using dmidecode, including
-t1 System
-t2 Base Board
-t3 Chassis
-t4 CPU
-t9 PCI slots
Full SMIBIOS Specification
1 System
2 Base Board
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 BIOS Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply
40 Additional Information
41 Onboard Device
There are many commands, tools, and variations of the two for you to put to work when it comes to system statistics in Linux. However, if you need the specifics around virtual memory, you want to use vmstat
.
What is it?
More Linux resources
Virtual memory statistics reporter, also known as vmstat
, is a Linux command-line tool that reports various bits of system information. Things like memory, paging, processes, IO, CPU, and disk scheduling are all included in the array of information provided.
When you run vmstat
, keep in mind that the first report is an average of the requested information since the time of the last reboot. Subsequent reports use measurements of delay and count. I cover those specifically during the syntax discussion.
Command syntax
The syntax for the vmstat
command is rather simple:
$ vmstat [options][delay [count]]
- Options - these are covered in detail in the following section.
- Delay - this defines the time interval between updates. If no delay is specified, the report runs as an average since the last reboot.
- Count - this defines the number of updates printed after the given delay interval. If no count is set, the default in an infinite number of updates every x seconds (where x = delay).
Basic output and how to make sense of it
The most basic form of this command uses no options at all. Here is the standard output and how to read it:
You see information around processes, memory, swap, IO, system, and CPU. The man page for the command states the following (man vmstat
):
Among the important information here, you find the amount of free memory on the system, as well as the amount of swap activity you are currently experiencing.
Options to know
The -a
option will give us the active and inactive memory of the system:
The -f
option will give us the number of forks since boot:
Note that a fork is any process that spawns another processes while remaining active.
The -s
option displays various memory statistics as well as CPU and IO event counters:
The -d
option gives you read/write stats for various disks:
The -t
option gives us timestamp information with every update, a seen here:
You see that there are 10 updates, printed every five seconds, with timestamp information attached.
Also, please note that all memory stats are displayed in kilobytes by default.
Summary
To wrap up, let's look at what we learned. The vmstat
command is a powerful system statistics tool that can be used with or without options. It prints updates using two main variables (delay and count), and we can customize the command and output to suit our needs. I hope that you have enjoyed this look at the vmstat
command. I will cover ifstat
in a forthcoming article, so keep an eye out for that!
Linux Command Memory Slots Downloads
[ Free online course: Red Hat Enterprise Linux technical overview. ]