How to tar

Tape ARchive (TAR) is an old file format that is used to archive files. Note that it does not compress the files to save space. Rather it is only for convenience of handling a single archive file instead of dealing with thousands of files. I typically use it to quickly move directories containing large number of small files.

  • To archive some files into a tape archive file specify the archive name first and follow with the files to archive:
$ tar -cf foobar.tar foobar1.txt foobar2.txt
  • To archive a directory:
$ tar -cf foobar.tar foobar
  • To view the list of files being archived specify the verbose option:
$ tar -cvf foobar.tar foobar
  • To extract or untar an archive to the current directory:
$ tar -xf foobar.tar
  • To view list of files during untar:
$ tar -xvf foobar.tar
  • To list the contents of an archive file:
$ tar -tvf foo.tar

Tried with: Tar 1.27.1 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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