Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I check if swap is active, and which swap devices are set up, on the command line?

share|improve this question

2 Answers 2

up vote 28 down vote accepted

in linux, you can use

  • cat /proc/meminfo to see total swap, and free swap (all linux)
  • cat /proc/swaps to see which swap devices are being used (all linux)
  • swapon -s to see swap devices and sizes (where swapon is installed)
  • vmstat for current virtual memory statistics

in Mac OS X, you can use

  • vm_stat to see information about virtual memory (swap)
  • ls -lh /private/var/vm/swapfile* to see how many swap files are being used.

in Solaris, you can use

  • swap -l to see swap devices/files, and their sizes
  • swap -s to see total swap size, used & free
  • vmstat to see virtual memory statistics

On some systems, "virtual memory" refers only to disk-backed memory devices, and on other systems, like Solaris, Virtual Memory can refer to any user process address space, including tmpfs filesystems (like /tmp) and shared memory space.

share|improve this answer
1  
Also, free should tell you how much swap is available to your system. –  paraxor May 28 '13 at 10:31

Try swapon -s for a list of current swap devices and other relevant information.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.