How to create an archive file in Unix or Linux operating system?
Create an Archive File in Linux:
In Linux, the tar command creates tar files by converting a group of files into an archive. It has the following syntax:
tar [OPERATION_AND_OPTIONS] [ARCHIVE_NAME] [FILE_NAME(s)]
OPERATION: Only one operation argument is allowed and required. There are mainly three types of operations are:
--create (-c)- It creates a new tar archive.
--extract (-x) – It extracts the entire archive or one or more files from an archive.
--list (-t) – It displays a list of the files included in the archive.
OPTIONS: There are mainly two types of options are:
--verbose (-v) – It shows the files being processed by the tar command.
--file=archive=name (-f archive-name) – It specifies the archive file name.
ARCHIVE_NAME: It is the name of the archive.
FILE_NAME(s): It is a space-separated list of filenames to be extracted from the archive.
tar --create --file=archive.tar cv.docx resume.docx biodata.pdf
Extract a Tar Archive file in Linux:
--extract (-x): It extracts a tar archive file.
tar -xf resume.tar