As explained before, the swap partition does not contain a filesystem and does not contain what we would consider files. Additionally, a swap (if active) gets completely wiped at boot, meaning it will be filled with zeros.
So, but how can you look inside a swap partition then? The answer is rather easy, and a disappointing one I fear...if you have started from another system which has not utilized the swap partition (a live system for example) it is possible to simply access the swap partition via it's partition entry in
To figure that out where the swap partition resides, run
fdisk -l as root, this will print the partition tables of all harddisks, like this one:
Disk /dev/hdb: 64 heads, 63 sectors, 621 cylinders
Units = cylinders of 4032 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 196 395104+ 83 Linux
/dev/hdb2 197 262 133056 82 Linux swap
/dev/hdb3 263 458 395136 83 Linux
/dev/hdb4 459 621 328608 83 Linux
Here we see that the swap partition is under
/dev/hdb2. So, how to read contents from it? With a hex editor, f.e.. If you're just curios you can also dump the contents and run it through
cat /dev/hdb2 | strings
Be warned that this will run your whole swap partition through the strings command, which will print all printable characters it finds...that's most likely lots of it.