Tar is a PC programming utility for gathering numerous records into one document, frequently alluded to as a tarball, for dissemination or reinforcement purposes. The name is gotten from primate chive, as it was initially evolved to compose information to consecutive I/O gadgets with no record arrangement of their own.
In this post, We will create a tar files using command line tool, The method is as per the following to tar a record in Linux:
Step 1: Open the terminal.
Step 2: For creating entire directory use the following command.
$ tar -czvf file_name_here.tar.gz /path/of/the/directory
Step 3: To create a sinlge file tar, Use the following command.
$ tar -czvf file_name_here.tar.gz /path/of/the/file_name_here
Step 4: For multi directory and files, Use the following commands.
$ tar -czvf file.tar.gz directory_1 directory_2 directory_4 # for multiple directory.
$ tar -czvf file.tar.gz file_name_1 file_name_2 file_name_3 # for multiple files.
Step 5: Extract the tar files and directory, Use the following commands.
$ tar -xzvf file_ name.tar.tz # for files.
$ tar -xzvf direcory_name.tar.tz # for directories.