If we were in the directory Desktop and wanted to backup all the files to a tarball called backups.tar, we could issue this command:
tar cvf backups.tar .
The flags here:c creates an archive, v makes the process run verbose and f sets the file name. The . tells tar to back up the current working directory. Use pwd if you’re unsure what that is. As we didn’t tell tar where to put the file it will automagically put it in the working directory. By default tar is recursive although you can specify an n flag to alter that default behavior.
Now, to display the contents of the tar file we just created, we can invoke tar using the tvf flags like so:
tar tvf backups.tar
This uses the t to display the table of contents of the file, the v to do so verbosely and the f to list the filename of the tarball. To extract all of the files from the tarball you can then use the xvf flags like so:
tar xvf backups.tar
This uses the x flag to extract, the v to do so verbosely and the f to indicate the file name of the tarball. If you wanted to only extract one file you would list that file name at the end of the command (start with source tar file then source file). You can also use wild cards in either the creation or extraction of a tarball. You can also use gzip utility with tar to compress the data by adding the z flag. Anyway, hope this helps in your backup endeavors.