I used the following command to create a compressed file of a folder:
tar -czvf /path-of-compressed-file/foldername.tar.gz /path-of-folder-to-compress/foldername >