Linux – Zip and unzip files

To zip a single file a in linux


You can find all my latest posts on medium.
gzip filename

To unzip a single file in linux

 gunzip filename 

To compress a directory the command is

 tar -cf filename.tar filename

filename.tar will be the new name of zipped file for filename.
-cf means creat a file
When compressing a directory it is important not to be in the directory. The command will not work otherwise.

To extract the filename.tar file the command is

 tar -xf goat.tar

-xf means extracting a file.