When looking vmstat, this is what I got:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 2872 0 0 0 0 8 17 0 14 3 1 94 2 0


the cache is 0. I have no idea how much the whole swap I have.

But when not enough RAM (256 MB), the swap will be used and look like below:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 1 2468 0 0 0 0 0 8 17 0 16 3 1 94 2 0

link|improve this question
feedback

5 Answers

Assuming this is on Linux - free -m will show you how much memory/swap you have in MB. Or cat /proc/meminfo

link|improve this answer
feedback

To see information about swap files currently in use on Linux:

cat /proc/swaps

or refer to swap information in meminfo for less detail:

cat /proc/meminfo | grep Swap

link|improve this answer
feedback

One of the header lines in top will be Swap info, and it's very clearly broken down.

This also has the advantage of working on any platform where top is installed (Every Linux/BSD I know of. Most Solaris, AIX & HP-UX machines (if it didn't come with the system some admin usually got around to installing it)).

link|improve this answer
(I got from top) Swap: 0k total, 0k used, 0k free, 0k cached – Cintaku Jan 29 '10 at 18:18
2  
Sounds like you don't have any swap configured (or it's not attached/enabled) -- that's a bit unusual but not impossible. Are there any lines in /etc/fstab with type "swap"? If so try "swapon -a" (as root) & the system will try to enable them. – voretaq7 Jan 29 '10 at 20:15
1  
True that top is almost everywhere, but I was surprised to find it missing on Tru64. Not that anyone cares about that any more... – David Dec 24 '10 at 21:23
htop is a more friendly version. :) – EricR Nov 4 '11 at 17:42
@EricR - True, but htop isn't everywhere (for that matter neither is top, but you know it will be there on the systems I listed). I suppose the truly portable alternative is swapinfo, but that requires you to do your own math for totals if you have more than one swap partition - top does it for you :-) – voretaq7 Nov 4 '11 at 18:22
feedback

Many systems have some command to detail this information outright: the commands are usually one of: swap or swapinfo or swapon (with appropriate option). Look up the man pages for these commands to find the specific information.

link|improve this answer
feedback

Execute

mkswap /path/to/dev

Then run

swapon -a
link|improve this answer
feedback

Your Answer

 
or
required, but never shown