Tar

From Leo's Notes
Revision as of 05:42, 17 February 2017 by Leo (talk | contribs) (Created page with "This is about the unix {{code|tar}} command. == Basic Usage == === Create Archive === Use the {{code|-c}} option to create. {{highlight|lang=terminal|code= $ tar -cf archive....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page was last edited on 17 February 2017, at 05:42.

This is about the unix tar command.

Basic Usage

Create Archive

Use the -c option to create.

$ tar -cf archive.tar file1 file2 ...

List Archive Contents

Use the -t option to list contents.

$ tar -tf archive.tar
file1
file2

Extracting Files

To extract everything, use the -x.

$ tar -xf archive.tar
$ ls
file1
file2

To extract only a specific file or folder, pass the filename or path name after the archive.

$ tar -xf archive.tar file1
$ ls
file1

To extract based on a pattern:

$ tar -xf archive.tar --wildcards --no-anchored '*le1'
$ ls
file1