smem

smem reports memory usage with shared memory divided proportionally among processes, includes swap usage

Typical usage: diagnosing performance issues, monitor memory usage, troubleshooting

Installation

When smem is not installed by default, it can be added to the system using the relevant software package.

Package information for smem

Operating systemPackage nameInstallation
AlmaLinuxsmem
dnf install smem
Arch Linuxsmem
pacman -S smem
Debiansmem
apt install smem
Fedorasmem
dnf install smem
Red Hat Enterprise Linuxsmem
dnf install smem
Rocky Linuxsmem
dnf install smem
Ubuntusmem
apt install smem

Your Linux distribution using a different package? Share your feedback.

Usage

Available options

Long optionShort optionDescription
--autosize-aSet column width to fit terminal size
--columns=COLUMNS-cDefine which columns to show
--help-hShow help
--abbreviate-kShow unit with suffix
--mappings-mMemory usage by mapping
--numeric-nShow user ID instead of username
--percent-pShow percentage
--reverse-rReverse the sorted data
--sort=FIELD-s FIELDSelect field to sort on
--total-tShow totals
--users-uMemory usage by user
--system-wSystemwide memory usage
--no-header-HDo not show the header in output
--kernel=PATH-K PATHPath to uncompressed kernel image (useful for -w)
--mapfilter=FILTER-M FILTERSet mapping filter (regular expression)
--processfilter=FILTER-P FILTERSet process filter (regular expression)
--realmem=AMOUNT-R AMOUNTDefine total amount of memory, also relevant for systemwide output (-w)
--source=PATH-S PATHDefines path to /proc. May be useful to investigate captured data from other system
--userfilter=FILTER-U FILTERSet user filter (regular expression)
--bar=FIELDShow bar graph for selected field (graphical)
--pie=FIELDShow pie graph for selected field (graphical)

Missing an option in this overview? Share your feedback.

Examples using smem

Memory and swap usage

Show processes and their memory usage

smem

Swap usage per process ID

Show only specific columns with data of interest

smem --columns="pid swap"

Frequently Asked Questions

What is the smem command and its purpose?

The command smem can help showing memory usage, including the usage of swap. Here are the most common options explained.

Which package provides the smem command?

The command smem is provided by the smem package.

Relevant articles using the smem command

The following articles include an example on how to use smem and might be worth further exploring.

Related and similar commands

Linux has a lot of tools and commands available and sometimes you just need that little other tool. Here is a list of commands that are similar or related to smem:

Related and similar commands to smem
CommandCategorySummary
basenamefilesStrips directory and file name suffix from a given path
blkidstorageShows block device information
dmidecodehardwareShows hardware information
numactlprocessesControls NUMA policy for processes and shared memory
pidstatmonitoringMonitoring CPU, memory, and disk activity
pmapprocessesShows memory mapping of process
prtstatprocessesShows process details for selected process like state, CPU and memory usage
pwdxprocessesShows current working directory of a process
slabtopmemoryShows slab usage of kernel
vmstatmemoryShows virtual memory information, disk IO, CPU activity

Also 💙 the command-line or terminal? Here is a set of cheat sheets for Linux to get more done from within the shell: