How to compress / extract tar files on Linux

Prev Next

Introduction

Problem description

Often the zip files have quite bad compression rate, or they have permission issues on Linux machines.

As a standard compress option, tar files have quite nice compression rate and speed on Linux systems.

1. GUI method to compress

  1. Right-click on the folder / file, and choose compress.

Right-click context menu for a folder named NavVis showing options — Open (Return), Open With Other Application, Open In New Tab (Ctrl+Return), Open In New Window (Shift+Return), Cut (Ctrl+X), Copy (Ctrl+C), Move to..., Copy to..., Move to Trash (Delete), Rename... (F2), Compress..., Open in Terminal, Send to..., Local Network Share, Star, Properties (Ctrl+I).

2. The zip options are displayed, select the tar.xz option.

Create Archive dialog showing Archive name field with NavVis, a file type dropdown currently .zip and a dropdown list of archive types: .zip — Compatible with all operating systems., .zip — Password protected .zip, must be installed on Windows and Mac., .tar.xz — Smaller archives but Linux and Mac only., .7z — Smaller archives but must be installed on Windows and Mac. Top buttons: Cancel and Create.

2. Terminal method to compress

You may also utilize the following command as an option to zip a file or directory:

tar -zcvf <name>.tar.gz <target_directory>

Compress into divided segments in specific situations when the individual compressed file is excessively large (e.g. divide the compressed files into 1024MB segments):

tar -cvj large-files.avi | split -b 1024m -d - "large-split.tar.bz."

3. Extract

tar -zxvf archive_name.tar.gz

To extract connected sections of compressed file:

cat large-split.tar.xz.* | tar -xzvf -

Note: the tar compress option has different variations, for example .gz, .xz, .bz. etc. Please change accordingly to your specific file type.


FAQ

What is the main problem with zip files on Linux machines?

Zip files often have a poor compression rate and may encounter permission issues on Linux systems.

What is a recommended compression option for Linux systems?

How can I compress a folder or file using the GUI method?

What command do I use to compress a file or folder in the terminal?

How can I extract a tar.gz file?

Is it possible to split a large compressed file into smaller chunks?

What should I do to extract connected chunks of a compressed file?

Are there different variations of the tar compress option?

Can I use the terminal method for compression on Linux?

Latest NavVis IVION Release