Tar is derived from the ' Tape Archiver (tape archive) ', which was originally used to archive and store files on tape. Tar is a GNU software that compresses a set of files (archives), extracts them, and operates on an existing archive file. It is useful for storing, backing up, and transferring files. When you create an archive, Tar keeps the original file and directory structure intact. Files archived through Tar have a suffix named '. Tar '.
The basic usage is as follows:
A) Create an archive (c/--create)
The code is as follows:
Tar--create--verbose--file=archive.tar file1 file2 file3
Or
The code is as follows:
Tar cvf archive.tar file1 file2 file3
Create an archive
(b) Listing the contents of the archive (t/--list)
The code is as follows:
Tar--list Archive.tar
List the files contained in the archive
c) Extraction Archive (x/--extract)
The code is as follows:
Tar xvf Archive.tar
Tar xvf archive.tar--wildcards ' *.c '
-Extracts a file with a suffix named *.c from the archive.
Extract Files
Extract only the required files
d) Update the archive (U/--update)
The code is as follows:
Tar UVF archive.tar newfile.c
-Add updated newfile.c to the archive if the archived newfile.c are newer than those previously archived.
Update an archive
(e) Delete files from the archive (--delete)
The code is as follows:
Tar--delete-f Archive.tar file1.c
-delete file ' file1.c ' from compressed package ' Archive.tar '
deleting files
For more specific use, refer to the TAR home page.