This is a collection of commands you can use to compress files with the highest compression levels possible.
This cheatsheet primarily uses XZ/LZMA as it has the best compression ratios most of the time (but not always). This algorithm generally has very slow compression times, but decompression is much faster. Similiarly, compression usually requires a lot of RAM, while decompression needs much less. The bigger is the file you're trying to compress, the more memory you will need.
Tools labeled (raw) below are programs that work on data streams. They do not understand filesystems and therefore cannot be used to compress multiple files or even directories. For such tasks you need an archiver (e.g. tar, 7-Zip, etc.). They will be labeled as (archiver).
Archivers like tar usually work by first creating an uncompressed archive file that is essentially a container for multiple files and directories, and then passing i