How to unpack TAR file or any compressed file, using Linux or MacOS

Personal speech, one of the pains of everyone who uses terminal, predominantly, is to unpack files of various extensions. Apart from the ZIP that to unpack we use UNZIP, we will have to remember options to add in the TAR command.

Thinking of creating an "untar" I ended up finding in a research the unar, which is all we seek. Super simple and practical to use, just run: unar file-a-descompactar.ext .

It seems to me that it already comes as default in several distributions, but nevertheless follows the Github repository for those who need:


Basic command for extracting any compressed file, without having to use options, use only the app name plus the file:

~ unar file-to-extract.ext

There are options to add and I will describe below:

~ unar --help
unar v1.10.1, a tool for extracting the contents of archive files.
Usage: unar[options] archive [files …]A

vailable options:-
output-directory (-o) The directory to write the contents of the archive to. Defaults to the current directory. If set to a single dash (-), no files will be created, and all data will be output to
-force-overwrite (-f) Always overwrite files when a file to be unpacked already exists on disk. By default, the program asks the user if possibl
e, otherwise skip files when a file to be unpacked alrea
dy exists on disk.-force-directory (-d) Always create
a containing directory for the contents of the unpacked archive. By default, a directory is created if there is more than one top-level file or fold
er.-no-directory (-D) Never create a containing directory for the contents of the unpacked ar
chive.-password (-p) The password to use for decrypting protected
archives.-e) The encoding to use for filenames in the archive, when it is known not. If not specified, the program attempts to auto-detect the encoding used. Use "help" or "list" as the
argument to give a listing of all supported encodings.
-password-encoding (-E) The encoding to use for the password for the archive, when it is not known. If not specified, then either the encoding given by the -encoding option or the auto-detected encoding
is used.
-indexes (-i) Instead of specifying the files to unpack as filenames or wildcard patterns, specify them as indexes, as output by lsar.
-no-recursion (-nr) Do not attempt to extract archives contained in other archives. For instance, when unpacking a .tar.gz file, only unpack the .gz file and not its contents.
-copy-time (-t) Copy the file modification time from the archive file to the containing directory, if one is created.
-forks (-k) How to handle Mac OS resource forks. "visible" creates AppleDouble files with the extension ".rsrc", "hidden" creates AppleDouble files with the prefix "._", and "skip" discards
all resource forks. Defaults to "visible".
-quiet (-q) Run in quiet mode.
-version (-v) Print version and exit.
-help (-h) Display this information.

When we quote any file is supported, of course there are some exceptions like DEB, DMG, PAR, SHG, ACE 2.0 (also winace standard) and Amiga.

Examples of supported extensions range from the most common to many others, such as: ZIP, RAR, 7Z (unencrypted), TAR, GZIP, BZIP2, LZMA, XZ, CAB, MSI, NSIS, EXE, ISO, SPLIT (basic junction), STUFFIT (without encryption), STUFFIT X, DISKDOUBLER, COMPACT PRO (unencrypted), PACKIT, CPIO, Z, ARJ (no split), ARC, PAK, ACE (DOS standard), ZOO, LZH, ADF, DMS, LZX, POWERPACKER, LBR, SQUEEZE , CRUNCH, XAR, RPM, ALZIP (unencrypted), NSA, SAR, NDS, ZIPX and other non-the-use extensions supported by the libxad library.

Liked this content, have any suggestions or other questions? Leave a message.

Follow me on Twitter @danielsob

To you who are interested in conducting more interactive tutorials with content like this, respect the research and construction of content, there is time and knowledge committed to this. Remember to quote the source. Everybody wins with this.