There are numerous tools available for monitoring memory usage in Linux, with options in both graphical and command-line formats.

Graphical memory monitoring tools are typically included with each Linux distribution's desktop environment, such as GNOME's System Monitor or KDE's Resource Monitor. Most Linux distributions also come with similar command-line tools for monitoring memory usage.

Two popular and widely used command-line tools for viewing memory usage in Linux are free and top. Both tools are convenient for use in the terminal, whether you're accessing the system remotely via SSH or automating tasks with shell scripts.

Steps to show memory usage information in Linux:

  1. Open your preferred terminal application.
  2. Show basic memory usage information with the free command.
    $ free
                  total        used        free      shared  buff/cache   available
    Mem:        2013428      999352      113610        6188      900376      842184
    Swap:        969960         524      969436
  3. Present basic memory usage information in a human-readable format using the free command.
    $ free -h
                  total        used        free      shared  buff/cache   available
    Mem:          1.9Gi       976Mi       111Mi       6.0Mi       879Mi       822Mi
    Swap:         947Mi       0.0Ki       946Mi

    More options for free command:

    $ free --help
    
    Usage:
     free [options]
    
    Options:
     -b, --bytes         show output in bytes
         --kilo          show output in kilobytes
         --mega          show output in megabytes
         --giga          show output in gigabytes
         --tera          show output in terabytes
         --peta          show output in petabytes
     -k, --kibi          show output in kibibytes
     -m, --mebi          show output in mebibytes
     -g, --gibi          show output in gibibytes
         --tebi          show output in tebibytes
         --pebi          show output in pebibytes
     -h, --human         show human-readable output
         --si            use powers of 1000 not 1024
     -l, --lohi          show detailed low and high memory statistics
     -t, --total         show total for RAM + swap
     -s N, --seconds N   repeat printing every N seconds
     -c N, --count N     repeat printing N times, then exit
     -w, --wide          wide output
    
         --help     display this help and exit
     -V, --version  output version information and exit
    
    For more details see free(1).
  4. Monitor application memory usage with the top command.
    $ top -n1 -o %MEM
    top - 16:25:49 up 40 min,  2 users,  load average: 0.08, 0.23, 0.34
    Tasks: 281 total,   1 running, 280 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  5.9 us, 17.6 sy,  0.0 ni, 76.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    MiB Mem :   1966.2 total,    108.4 free,    975.9 used,    881.9 buff/cache
    MiB Swap:    947.2 total,    946.7 free,      0.5 used.    822.1 avail Mem
    
       PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
      1511 user      20   0 2575320 203944  87640 S   0.0  10.1   0:44.31 gnome-shell
      1931 user      20   0  777408 119956  36288 S   0.0   6.0   0:03.91 gnome-software
      2385 user      20   0 1393488  99916  54312 S   0.0   5.0   1:04.11 rhythmbox
      2054 user      20   0 1043436  97064  44896 S   0.0   4.8   0:09.76 streamtuner2
      1745 user      20   0  803280  56900  45324 S   0.0   2.8   0:00.44 evolution-alarm
      1374 user      20   0  259016  54708  32968 S   0.0   2.7   0:15.65 Xorg
      1930 user      20   0  986610  45828  33144 S   0.0   2.3   0:04.31 gnome-terminal-
      1933 user      20   0  702652  39440  25932 S   0.0   2.0   0:00.31 seahorse
      1771 user      20   0  344420  37420  29520 S   0.0   1.9   0:03.53 vmtoolsd
      1788 user      20   0  750852  33624  28984 S   0.0   1.7   0:00.31 evolution-calen
      1589 user      20   0  628356  32944  27610 S   0.0   1.6   0:00.12 goa-daemon
      1801 user      20   0  695356  30780  27012 S   0.0   1.5   0:00.06 evolution-addre
      2341 user      20   0  518056  29224  22776 S   0.0   1.5   0:00.29 update-notifier
      1610 user      20   0  499596  28968  24656 S   0.0   1.4   0:00.12 evolution-sourc
       641 root      20   0  676140  27736  13008 S   0.0   1.4   0:03.15 snapd
       411 root      19  -1   58116  27384  25840 S   0.0   1.4   0:01.77 systemd-journal
      1553 user      20   0  295756  26080  16944 S   0.0   1.3   0:00.77 ibus-extension-
      1647 user      20   0  925768  25924  18964 S   0.0   1.3   0:00.48 gsd-media-keys
      1660 user      20   0  515152  24880  18260 S   0.0   1.2   0:00.28 gsd-color
      1640 user      20   0  369336  24764  18168 S   0.0   1.2   0:00.24 gsd-power
      1666 user      20   0  367312  24732  17764 S   0.0   1.2   0:00.31 gsd-xsettings
      1746 user      20   0  472812  23856  11652 S   0.0   1.2   0:00.25 tracker-store
      1638 user      20   0  366800  23796  17368 S   0.0   1.2   0:00.23 gsd-keyboard
      1557 user      20   0  218820  23624  17328 S   0.0   1.2   0:00.22 ibus-x11
      1576 user      20   0  518380  23408  20332 S   0.0   1.2   0:00.09 gnome-shell-cal
      1654 user      20   0  294528  23128  16672 S   0.0   1.1   0:00.22 gsd-wacom
      1652 user      20   0  218360  22776  16488 S   0.0   1.1   0:00.75 gsd-clipboard
       771 root      20   0  131004  21936  13820 S   0.0   1.1   0:00.31 unattended-upgr
      1752 user      39  19  519912  21832  14252 S   0.0   1.1   0:00.17 tracker-miner-f
      2034 root      20   0  389564  20808  17412 S   0.0   1.0   0:00.23 fwupd
      1592 user       9 -11 2217220  19200  15460 S   5.9   1.0   2:47.65 pulseaudio
       612 root      20   0   52112  18992  10972 S   0.0   0.9   0:00.23 networkd-dispat
       632 root      20   0  424316  18976  16120 S   0.0   0.9   0:00.51 NetworkManager
      1761 user      39  19  661240  18916  11748 S   0.0   0.9   0:00.15 tracker-miner-a
       835 whoopsie  20   0  331610  15532  13660 S   0.0   0.8   0:00.07 whoopsie
      1674 user      20   0  321672  15344  13440 S   0.0   0.8   0:00.02 gsd-datetime
      1382 user      20   0  583368  15296  12536 S   0.0   0.8   0:00.22 gnome-session-b
      1314 colord    20   0  257832  13772   8788 S   0.0   0.7   0:00.22 colord
      1698 user      20   0  367052  13392  11628 S   0.0   0.7   0:00.02 gsd-printer
       652 root      20   0  393988  12752  10204 S   0.0   0.6   0:00.18 udisksd
       684 root      20   0  182624  11972  10412 S   0.0   0.6   0:00.12 cups-browsed
       540 root      20   0  133576  11610  10264 S   0.0   0.6   0:02.97 vmtoolsd
  5. Examine specific application memory usage using the top command.
    $ top -n1 -o %MEM | grep rhythmbox
      2385 user      20   0 1393488  99916  54312 S   6.2   5.0   1:06.10 rhythmbox

    More options for top command:

    $ top -help
      procps-ng 3.3.15
    Usage:
      top -hv | -bcEHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]
Discuss the article:

Comment anonymously. Login not required.