Ubuntu includes GNU tar, which recognizes the format by itself! One command works with any supported compression method, per the manual.
tar xf archive.tar.xz
tar xf archive.tar.gz
tar xf archive.tar
etc. If tar gives a error, you may need to Cannot exec first.sudo apt install xz-utils
Since you are not allowed to use outside libraries, you are not restricted to a specific format of the file either. In fact, they don't even need it to be all in the same file.tar
You can write your own tar-like utility in C# that walks a directory tree, and produces two files: a "header" file that consists of a serialized dictionary mapping instances to an offset/length pairs, and a big file containing the content of individual files concatenated into one giant blob. This is not a trivial task, but it's not overly complicated either.System.IO.Path
If gives this message: POSIX tar archive,
the archive is a tar, not a GZip archive.file filename.tar.gz
Unpack a tar without the , it is for gzipped (compressed), only:z
mv filename.tar.gz filename.tar # optional
tar xvf filename.tar
Or try a generic Unpacker like (https://packages.qa.debian.org/u/unp.html), a script for unpacking a wide variety of archive formats.unp
determine the file type:
$ file ~/Downloads/filename.tbz2
/User/Name/Downloads/filename.tbz2: bzip2 compressed data, block size = 400k