tar or tape archive is a basic tool that every Linux user should know.
Its syntax is quite different from the traditional copy or move command.
Since tar works from a 'current working directory' perspective.
Traditional syntax for copy or move is source then the destination.
In tar, the syntax is the filename or the path where the backup will be save and the source or the folder to be backed up or archived.
Typing: man tar (at the terminal shows the following)
tar -cf archive.tar foo bar
# Create archive.tar from files foo and bar.
Basically, it's like the destination where the file will be saved and the source or the files that will be archived.
Here's a simple bash script that will append the time and date the tar file was executed to the filename of the tar file.
If the bash script is automated via cron, the filename of the tar file will include the date and time the cron executes the script.
tar -Pczvf /mnt/offsite/usb/backup_$NOW.tar.gz /usr/b_folder/bkfolder
-P parameter is just to suppress the message "tar: removing leading /' from member names"
To view the contents of the tar file without extracting it type the following:
tar -tf filename.tar.gz to view the contents of the tar file.
To extract the tar file to another directory type:
tar -xvzf filename.tar.gz -C ~/home/xtraction
To use tar to backup to a remote computer see the following link:
Cheers! Till next time.
Free Android Apps:
Click on links below to find out more:
Linux Android App cheat sheet:
Multiplication Table for early learnershttps://play.google.com/store/apps/details?id=com.TableMultiplication
Catholic Rosary Guide for Android:
Divine Mercy Chaplet Guide (A Powerful prayer):