I have a requirement to create a Inspec test to check the swap space of a linux system and pass if the swap space is greater than or equal to a certain value say 4GB. Is there an appropriate matcher for the command resource ?

It looks like your “free” command should be “free -mt”. If you check for raw “free” output, that counts by bytes, not by Megabytes. I hope you caught this before you used your command, because it would report when you have less than 4000 bytes free, not 4 GB.