List processes currently using swap space



Published: 2021-05-20 15:24:55 +0000
Categories: BASH,

Language

BASH

Description

When trying to work out where all your RAM went, it's sometimes useful to be able to take a look at what currently has pages in swap.

It's worth bearing in mind, though, that processes listed aren't necessarily the root cause - they may well have been paged out to free up RAM for some other process

Snippet

for file in /proc/*/status ; do awk '/Name|VmSwap/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r

Keywords

swap, ram, memory, linux, programs, process, vmswap,

Latest Posts


Copyright © 2021 Ben Tasker | Sitemap | Privacy Policy
Available at snippets.bentasker.co.uk and http://phecoopwm6x7azx26ctuqcp6673bbqkrqfeoiz2wwk36sady5tqbdpqd.onion