This brief tutorial shows students and new users how to extract or unzip tar archived files compressed with bzip2 compression ending in .tar.bz2 or .tbz2 on Ubuntu 18.04 LTS.
If you’re a student or new user looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS…. It’s a great Linux operating system for beginners.
Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…
During your introduction to Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.…
Both Ubuntu and Windows systems allow you to be productive, easy to use, reliable and enable you to install and run thousands of programs from gaming to productivity suite software for individuals and businesses.
However, when you’re learning to use and understand Ubuntu Linux, you should also learn how to use the command line to terminal. Most Linux users should be able to do some basic command line tasks. This tutorial is going to show you how….
When you’re ready to learn how extract files compressed with bzip2, follow the guide below:
About tar command:
On Linux systems, including Ubuntu the tar command creates, maintain and extract files that are archived in tar format. “Tar” stands for tape archive. It is one of the many archiving file format available.
The syntax is the rule and format of how the tar command can be used. These syntax options can be reordered, but a straight format must be followed.,.
Below is an example syntax of how to use the tar command.
tar [OPTION.] [FILE].
The command line options are switches or flags that determined how the commands are executed or controlled. they modify the behavior of the commands. they are separated by spaces and followed after the commands.
Below are some options of the tar command:
|FILE.||Replace FILE.. with the name of the archived file you wan to extract.|
|-x, –extract, –get||Use the -x or –extract or –get to extract files from an archive|
|-f, –file=ARCHIVE||Use the -f or –file to specify the use of archive file to extract|
|-v, –verbose||Use the -v or –verbose to verbosely list files being processed|
|-j, –bzip2||Use the -j or –bzip2 to filter the archive through bzip2 compression|
|-t, –list||Use the -t or -list to list the content of an archive|
|–help||Display a help message and exit.|
Below are some examples of how to run and use the tar on Ubuntu Linux.
Simply run the tar command to invoke it.
To extract a tar archive file compressed with bz2 compression algorithm, you run the command below:
tar -xvjf archive.tar.bz2
The command above will extract the archive file into the current working directory. The -j option tells tar that the file is compressed with bzip2.
A file compressed with .tar.bz2 and you run the tar command without a decompression option, the command will error out and tells you to use the -j option for it to be successful.
If you with to extract the above archived file into a specific directory, you run the commands below:
tar -xvjf archive.tar.bz2 -C /home/myaccount/public
The command above will extract the archive file into /home/myaccount/public directory or folder.
If you want to list the content of an archived file compressed with tar.bz2, you use the -t or –list command options.
tar -tf archive.tar.bz2
That should list the content of the archive. Remember to always use the -f option to tell the command you’re working with a file archive.
When you run su with the –help option, you’ll see the help text below:
Usage: tar [OPTION.] [FILE]. GNU 'tar' saves many files together into a single tape or disk archive, and can restore individual files from the archive. Examples: tar -cf archive.tar foo bar # Create archive.tar from files foo and bar. tar -tvf archive.tar # List all files in archive.tar verbosely. tar -xf archive.tar # Extract all files from archive.tar. Local file name selection: --add-file=FILE add given FILE to the archive (useful if its name
Congratulations! You’ve learned how to use the tar command to extract archived compressed with .tar.bz2 or .tar.bzip2 on Ubuntu.
You may also like the commands below: