diff --git a/site/pages/cmd/interm/tar.html b/site/pages/cmd/interm/tar.html new file mode 100644 index 0000000..0f9dd90 --- /dev/null +++ b/site/pages/cmd/interm/tar.html @@ -0,0 +1,68 @@ +--- +layout: page +category_title: interm +category-page: interm +tags: tar shell command compress archive +author: Nicola Brunner +title: tar +--- + +

The tar command is used to create and manipulate streaming archive files, in + other words it is used to compress and extract files and directories. He can + extract from many file formats like: tar, pax, cpio, zio, jar, ar and ISO 9660 + cdrom images and create tar, pax, cpio, ar, and shar archives.

+
+ +

Usage:

+ +

There are different syntaxes for this command:

+
tar {-c} [options] [files | directories]
+

The first one is the default syntax. Where {-c} stays for the + creation of a new archive, [options] for the different flags that + we can use, [files | directories] for the files or directories + that we want to compress.

+

tar {-r | -u} -f archive-file [options] [files | directories]
+tar {-t | -x} [options] [patterns]
+tar [bundled-flags ] [ | ...]
+

The last one shows a “bundled” option word provided for compatibility with + historical implementations.

+
+ +

Flags:

+ +

This command has a large number of options, but you just need to remember a + few letters for the most important ones:

+ + + +

If you don’t find here an option that you search, or you are interested to read +more about this command, you can write in your terminal:

+

tar man
+
+ +

Example:

+
tar -cvf archive.zip makesmaller.jpg
+

In this case, we take the file makesmaller.jpg and compress it + to archive.zip. We use the options -cvf, -c + for creating a new archive, -v for displaying the progress of the + operation and -f for specifying the name of the archive. + +

tar -cvf archive.zip makesmaller.jpg alsome.txt
+

It’s the same case as before, but we wanted to add also alsome.txt + to archive.zip.