tar is an archive utility tool for GNU/Linux
. Primarily used to distribute executable software
or package the software source code in the tarball for later distribution. The most popular being gzip and you might have noticed the source file of a program usually ends with *.tar.gz. Well, that doesn’t mean you can’t use it to create an archive for other file types
. You can.
Well, let’s learn how to archive a file. Launch terminal using ctrl+alt+t and cd into your Music directory, choose a song you wish to archive.
In my case, I’ve chosen the song Kevin_S._-_Universum.ogg.
Now let’s tar it!Type in –
Hit Enter and you’ll see the audio file has been archived.
tar is the program for manipulating a tarball and the arguments:
Then again tar supports combination of arguments so you don’t have to explicitly pass arguments as in –
The third argument universum.tar is the output of the program and the fourth following it is the input file.
So, overall we have this format.tar arguments <output file> <input file(s)>
Well someone sent you a *.tar file and you wish to extract the contents. So onto the previous file, we just created, here is the CLI way to untar it.
But before I hit Enter I must make sure the audio file is deleted to avoid overwriting.
hit Enter and the file is extracted.
What if you wanted to tar multiple audio files at once? This is best done by specifying multiple arguments like the one below shows how to tar two audio files at once.
But what if you wanted to tar all the audio files at one go? Here is how it is done –
Now, for instance, you archived the file but you want to make sure it really is in the file. Don’t worry here is the solution to view the list of file(s) in the *.tar file –
Need more detailed information or you might want some output as tar carries out its work. This is done by enabling verbosity.
Remember you cannot pass verbosity along with the arguments of the tar program in conjunction! This is because -1. tar don’t do it that way.
2. verbosity exists almost in every Linux utility program
That’s about it for now. You have just learned one of the basic stuff every FOSS developers out there do. Maybe it’s not sufficient enough for the programmers out there but the basic is outlined and you may further go on how to package your source code in *.tar.gz (Easy-bitsy just a few arguments to pass).