Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 913 Bytes

tar.md

File metadata and controls

31 lines (24 loc) · 913 Bytes

tar: File-Archive Tool

tar was originally designed for archiving files to tape. It is still useful however in moving entire directory structures between systems.

The format of the tar command is:

tar options directory

Tar unlike most Unix commands does not require the - before the options. Here are some your instructor uses frequently.

  • c : Create an archive
  • x : Extract files from an archive
  • p : Attempt to save file permission and ownership information
  • v : Verbose mode
  • t : Test the archive
  • f : Use a tar file
  • z : compress the file using (gzip(1))

As an example let's create a tar file of everything under ~/Desktop.

cd ~
tar cvpf /tmp/command_line_curriculum.tar ~/command_line_curriculum/

This file can then be shared and untarred with

tar xvpf /tmp/command_line_curriculum.tar 

on another computer and have the same contents.