Figure out used swap from command line?

When looking at the Activity Monitor it says that I am using 459.5MB of swap.

I would like to figure this number out from the command line.

I have been able to duplicate all the other memory numbers presented by the Activity Monitor using vm_stat, but now I want swap usage as well.

Help?

Activity Monitor, swap file usage 459.5MB


You can get the current swap usage on the command line by running the following command:

sysctl vm.swapusage

It will output something similar to:

vm.swapusage: total = 4096.00M  used = 2743.50M  free = 1352.50M  (encrypted)

The number in "used" should correspond with the number you've circled in Activity Monitor.