This command will print information about your swap partition easily using the Linux command line.
root@Yog-Sothoth:~# swapon -s -v Filename Type Size Used Priority /dev/sda5 partition 7811068 0 -2 /dev/dm-1 partition 62500860 0 -3 |
The –show parameter allows customizing the output. This is useful for only displaying the columns that you wish to output. I am showing the UUID, the amount of used disk space, and other pertinent information.
root@Yog-Sothoth:~# swapon --show="UUID,USED,SIZE,LABEL,NAME,TYPE" UUID USED SIZE LABEL NAME TYPE 708eeee4-4503-4755-8427-21a52921d7ba 0B 7.5G /dev/sda5 partition 7bb6b380-aeff-4389-9c48-687d4d6dc58d 0B 59.6G /dev/dm-1 partition |
Another way to get good information about the Linux swap partition.
root@Yog-Sothoth:~# lsblk | grep SWAP ├─sda5 8:5 0 7.5G 0 part [SWAP] │ └─fedora-swap 253:1 0 59.6G 0 lvm [SWAP] |
To get comprehensive information about what is actually in your swap partition, use the smem utility.
Just install the utility on your Linux system.
sudo apt-get install smem |
Then run this command to get this information. This is the abbreviated content of my swap partition.
4.4 Thu Sep 19 jason@Yog-Sothoth 0: $ smem -s swap -t -k -n PID User Command Swap USS PSS RSS 4124 1000 /lib/systemd/systemd --user 0 1.6M 2.4M 8.3M 4142 1000 /usr/lib/gdm3/gdm-x-session 0 668.0K 739.0K 5.9M 4148 1000 /usr/bin/dbus-daemon --sess 0 1.7M 1.8M 5.4M 4155 1000 /bin/sh /snap/communitheme/ 0 204.0K 213.0K 1.8M 4261 1000 /usr/lib/gnome-session/gnom 0 3.0M 3.4M 14.8M 4263 1000 /usr/lib/at-spi2-core/at-sp 0 796.0K 918.0K 6.9M 4268 1000 /usr/bin/dbus-daemon --conf 0 528.0K 624.0K 4.2M 4270 1000 /usr/lib/at-spi2-core/at-sp 0 828.0K 933.0K 7.0M 4287 1000 /usr/bin/gnome-shell 0 195.9M 213.2M 268.3M 4293 1000 /usr/lib/gvfs/gvfsd 0 1.1M 1.2M 7.1M 4298 1000 /usr/lib/gvfs/gvfsd-fuse /r 0 1008.0K 1.1M 6.2M 4309 1000 /usr/bin/pulseaudio --start 0 17.9M 20.4M 28.7M 4324 1000 ibus-daemon --xim --panel d 0 1.6M 1.8M 7.9M 4325 1000 /usr/libexec/xdg-permission 0 588.0K 664.0K 5.6M 4332 1000 /usr/lib/ibus/ibus-dconf 0 796.0K 919.0K 6.7M 4334 1000 /usr/lib/ibus/ibus-x11 --ki 0 4.6M 5.0M 20.6M 4336 1000 /usr/lib/ibus/ibus-portal 0 716.0K 818.0K 6.6M 4346 1000 /usr/lib/gnome-shell/gnome- 0 3.6M 5.2M 21.0M 4355 1000 /usr/lib/dconf/dconf-servic 0 1.4M 1.5M 5.7M 4356 1000 /usr/lib/gvfs/gvfs-udisks2- 0 2.3M 2.6M 10.0M 4365 1000 /usr/lib/gvfs/gvfs-mtp-volu 0 796.0K 843.0K 6.0M 4366 1000 /usr/lib/evolution/evolutio 0 4.9M 6.1M 25.2M 4370 1000 /usr/lib/gvfs/gvfs-gphoto2- 0 1.1M 1.2M 6.7M 4377 1000 /usr/lib/gvfs/gvfs-goa-volu 0 800.0K 900.0K 6.0M 4380 1000 /usr/lib/gnome-online-accou 0 5.7M 11.3M 31.0M |
This shows that it is still used on modern systems. I have 12 gigabytes of RAM, and it still needs the swap partition. I am not sure if Linux still has a kernel panic if it runs out of memory, but it is better to be safe than sorry.