Tar files (short for tape archive files) are created by using the tar command of the Linux operating system. This will convert a number of specific files into an archive. Once an archive is created using tar, the individual files are contained within it, as well as the necessary information to restore the files to their original form by way of an extraction program. Archives are a convenient means for storing files and programs as they are much easier to work with than a bunch of individual files.
Tar was initially designed as a means to make backups on magnetic tape, but is now used to create archives anywhere on a hard drive. Creating a tar file or archive is commonly referred to as "tarballing".
Required tools and materials
- Computer running the Linux operating system
Open a terminal session in Linux
To do this, click the terminal icon located on the bottom bar, or click the home bottom and search for the word "Xterm"
Type in the commands to run tar
Once the terminal session is open type in "tar-cf" (The "c" means that you are creating a tar file while the "f" means that that you want to able to specify the name of the tar file.
Create a name for the file
Press the spacebar and enter the full name and extension that is to be given to the file that you are tarballing. If you are tarballing document files for example, you can type "documents.tar"
Enter the path of the directory
This will differ depending on where the file is saved but should be similar to "hddhomeuserdocuments". If the command was made from the "user" directory then all that would need to be written is "documents".
Complete the creation of the tarball
Double check all the commands and then press enter
Tips & Warnings
- The original files will not be deleted or moved when a tarball is created.
- The archive created does not have to use the .tar extension, but it is recommended that this format is kept because it makes the files easier to identify later on.
- To update or add more files to a tar file that has already been created, instead of "cf" in the first line type "uf". This will ensure that files are written to the end of the existing file or only copy new files during an update.
- Updating tar files will take some time so be patient while the process completes
- If problems arise, help is available through Linux by typing "tar-help"
- Tarballs do not compress information (the size of the files remains the same) To compress a file, another utility such as gzip will be required. The file name will then be
- Windows based PCs and Macs will often be able to restore archives that are currently in the tar file format. Macs users can download Stuffit Deluxe for this purpose, wile PC users can try pkunzip.
Kapil Edke is a free lancer writer and content builder of www.explaintechstuff.com