• Create an archive(bundle together a bunch of files and directories into a single file)
    $ tar -cvf file.tar  file1 file2 subdir1 subdir2
    $ tar -cvf file.tar dirname


  • Extract files from an archive(recover all the files and directories from the tar file)
    $ tar -xvf file.tar
    $ tar -xzvf file.tar.gz


  • Lists contents of a tar file
    $ tar -tf /path/to/file.tar

Note: creating an archive file ("tar file") does not delete the original files or directories. Extracting files from a tar file will overwrite any previously existing files of the same names.