Introduction
You may want to view the contents of swap when troubleshooting memory and performance issues on your server.
Procedure
Run the below command to view the contents of swap:
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less
The output will look similar to this:
mysqld 79528 kB
pdns_server 30620 kB
httpd 14924 kB
httpd 14916 kB
httpd 14912 kB
httpd 14904 kB
httpd 13904 kB
httpd 13768 kB
httpd 13420 kB
tuned 12092 kB
systemd-journal 9548 kB
polkitd 4472 kB