note Please refer to https://www.cyberciti.biz/faq/tar-extract-linux/
Extract or Unpack a TarBall File
tar command
To Unpack a .tar file
$ tar -xzf filename.tar
To Extract a .tar.gz file
$ tar -xzvf filename.tar.gz
To extract a .tar.bz2 file
$ tar -xjvf filename.tar.bz2
flags
-x: Extract a tar ball
-v: Verbose output or show progress while extracting files
-j: Decompress and extract the contents of the compressed archive created by `bzip2` program (`.tar.bz2` extension)
-z: Decompress and extract the contents of the compressed archive created by `gzip` program (`.tar.gz` extension)
bzip2 command
# this command will not preserve original archive file
$ bzip2 -d filename.bz2
# this command will preserver the origina archive file
$ bzip2 -dk filename.bz2
unrar package on Ubuntu
Referencehttps://askubuntu.com/questions/41791/whats-the-easiest-way-to-unrar-a-file
$ sudo apt install unrar
$ unrar e -r /file.rar
# The following command will preserve the directory structure
$ unrar x -r /file.rar