smem

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

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

Short optionLong optionDescription
-a--autosizeSet column width to fit terminal size
-c--columns=COLUMNSDefine which columns to show
-h--helpShow help
-k--abbreviateShow unit with suffix
-m--mappingsMemory usage by mapping
-n--numericShow user ID instead of username
-p--percentShow percentage
-r--reverseReverse the sorted data
-s FIELD--sort=FIELDSelect field to sort on
-t--totalShow totals
-u--usersMemory usage by user
-w--systemSystemwide memory usage
-H--no-headerDo not show the header in output
-K PATH--kernel=PATHPath to uncompressed kernel image (useful for -w)
-M FILTER--mapfilter=FILTERSet mapping filter (regular expression)
-P FILTER--processfilter=FILTERSet process filter (regular expression)
-R AMOUNT--realmem=AMOUNTDefine total amount of memory, also relevant for systemwide output (-w)
-S PATH--source=PATHDefines path to /proc. May be useful to investigate captured data from other system
-U FILTER--userfilter=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"

Relevant articles using the smem command

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