Freebsd – How to find out what is using swap on FreeBSD

freebsdprocess-managementswap

I'm trying to pinpoint what process(es) is eating swap on my FreeBSD server.

I can only see how much is being used (top) but not what process is swapping its guts out.

I tried searching Google for this but didn't find anything.

Is there a way to display list of swapped data by process natively or by using some external software to achieve this?

Thanks.

Best Answer

FreeBSD's ps command prints a W in the state column to indicate that a process is swapped out. By default, ps prints state as the third column, so this will give you what you want:

$ ps ax | awk 'NR==1{print};$3 ~ /W/'

'NR==1{print}' will give you the column headers. Omit it if you don't need or want them.

Note also that FreeBSD's top displays swapped out processes with their name (the final column) surrounded by angle brackets.

Related Question