The command "tar" on Linux or Mac OS terminal is used to compress the folder into a tar/archive file. This page helps in the basic usage and explains how to compress extract files using tar command. The description from the man page says -
tar creates and manipulates streaming archive files. This implementation can extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar archives.