tar [Command]

Command tar

tar – Creates archive files or extract files from archives.

Syntax

tar [options] file_or_directory

Options

-c: creates a new archive.
-d: compares the files from the archive files from the current directory.
-r: adds the files in the archive.
-t: displays the contents of the archive.
-x: extracts files from the archive.
-C: directory extracts the files in the specified directory.
-f: file read the archive from the specified file.
-L n: determines the size of the tape to n kilobytes.
-N: date archive only files newer than specified date.
-T: file archives or extract files with names listed in the file file.
-v: verbose.
-z: compresses or decompresses the archive with gzip.
-j: compresses or decompresses the archive through bzip2.

Description

The tar command creates an archive file, or extract files from existing archives.

Examples

Tar Multiple Files and Folders With One Command

tar czf tarfile.tar.gz --files-from /folder/subfolder/files_list 

files_list below:

/folder/subfolder/file1
/folder/subfolder/file2
/folder/subfolder/c/file3
/folder/subfolder//c/d/file4
/folder/subfolder/test1
/folder/subfolder/test2
/folder/subfolder/c/test3
/folder/subfolder/c/d/test4

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.