We need to have root privileges to run dmidecode. Once we run the command, we’ll be able to see detailed hardware information. Once the installation is complete, we can run the dmidecode command from our terminal: # dmidecode Sometimes, we don’t need all the info, so we can use grepto extract only the desired entry: $ vmstat -s | grep -i 'total memory' | sed 's/ *//' 8021048 K total memory The first entry in the output is total physical RAM. Since we’re interested in total RAM size, we’re going to add the -s or –stats flag: $ vmstat -s 8021048 K total memory The -w or –wide flag prints the output in a wide readable format. By default, when we type the vmstat command, it will print the free, buffered, and cached memory alongside swap, CPU, IO, and system information: $ vmstat -w -procs-memory-swap-io-system-cpu. Like the free command, vmstat (virtual memory statistics) is also available on most Linux distributions. We can easily terminate the process with Ctrl + C keyboard shortcut. It’s especially useful if we want to monitor the RAM usage at a specified interval. The -s flag stands for seconds, so free will print the RAM usage every 5 seconds in this example. One more interesting option is the -s option: $ free -h -s 5 Moreover, there are lots of other options that can be used to print the output in the format we like such as –kilo, –mega, –Giga, and so on. However, we can easily print the output in a human-readable format using the -h or –human flag: $ free -h total used free shared buff/cache availableĪs can be seen in the output above, we have a total of 7.6 GiB of RAM. We can simply type the free command on our terminal without any flags: $ free total used free shared buff/cache available The free command is one of the widely used commands to quickly check for RAM stats because it’s available on most Linux distributions. It’s used to print the physical and swap memory usage - by default, it prints to standard output. Free is the simplest of all the commands we’ll see.
0 Comments
Leave a Reply. |