How to know how many swap space exist in linux system

How to know how many swap space exist in system

When I started using linux I was curious to know from where I can get info, how many swap space exist in system.
I hope this post will help the linux beginners.
To know about how many swap space exist in system either it is in activated or deactivated use the given below command.

cat /proc/swaps

Given below is reference of my system

root@ubuntu:/# cat /proc/swaps 
Filename				Type		Size	Used	Priority
/swapfile-2                             file		524284	0	-2
/swapfile-additional                    file		1048572	0	-1
/dev/dm-1                               partition	1044476	0	-3
root@ubuntu:/#

To know how many swap space are in Activated states

Use below given command

swapon -s

Below is the reference of my system

root@ubuntu:/# swapon -s
Filename				Type		Size	Used	Priority
/swapfile-2                             file		524284	0	-1
/dev/mapper/ubuntu-swap_1               partition	1044476	0	-2
root@ubuntu:/#

Note: /swapfile-additional is disable hence it is not shown in Output

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.