DEV Community

Josh
Josh

Posted on

File Compression and Packaging in Linux

Working with File compression and packaging.

tar -cvf myarchive.tar mydir/ # -c Create, -v Verbose, -f File
tar -tvf myarchive.tar # lists whats in your tar archive
tar -xvf myarchive.tar -C mynewdir # Extract your tar. -x Extract, -v Verbose, -f File, -C change to directory before extracting.

gzip myarchive.tar # will create you a myarchive.tar.gz
or 
tar -czvf myarchive.tar.gz /path/to/extract

tar -xzvf myarchive.tar.gz -C /path/to/extract # -x Extract, -z Uncompress

Tar - used for packaging files and directories together
gzip, bzip2, xz - is used for compressing

zip -r myarchive.zip /myarchive 
unzip -d /path/to/unzip/unzipped myarchive.zip
Enter fullscreen mode Exit fullscreen mode

Top comments (0)