How To tar/zip (compress) a file or folder in Linux

To compress a file in Linux, you can use one of the two utilities.

  1. Tar
  2. zip

Compress Files/Folders using tar

To compress a file a folder use the following command.

tar -cvf output.tar <file/folder name>

To compress multiple files and folders,

 tar -cvf output.tar <file1> <folder1> <file2> <folder2>