Archiving file commands in Linux using tar

Hi, How are you !! Hope you doing good....
I got introduced to Cloud initially. As I went ahead learning what is cloud and how it works, then got to know a field which is DevOps that makes Cloud model more effective.
So, as I started working & got good experience on AWS. I have been learning the DevOps tool and technologies on how to use it with the Cloud, which will give me good understanding on how Cloud and DevOps go hand in hand to deploy my applications.
Last Blog Review →
In the last blog we understood, the basics of archiving what it does and how archiving is done in Linux using Tar command. Tar command syntax and it’s option which is used to modify the tar command. Later on in coming blogs we will see the use of tar command to archiving files and directories and extracting it.
Linux commands for Archiving files
To create tar archive file
tar -cvf my_archive.tar /home/user/projectTo extract the archive file on desired location
tar -xvf my_archive.tar -C /home/user/logsTo extract the archive file on default location
tar -xvf my_archive.tarTo create a tar archive file with compress in size using gzip
tar -czvf my_archive.tar.gz /home/user/projectTo extract a compress archive file in gzip
tar -xzvf my_archive.tar.gzTo create a tar archive file with compress in size using bz2
tar -cjvf my_archive.tar.bz2 /home/user/my_foldersTo extract a compress archive file in bz2
tar -xjvf my_archive.tar.bz2To show the file size in human readable format
du -sh /home/user/my_projectsTo create a compress archive file in xz
tar -cJvf my_archive.tar.xz /home/user/my_foldersTo extract a compress archive file in xz
tar -xJvf my_archive.tar.xz
Conclusion →
In the blog we understood the commands to archive a file using tar in Linux along with different compression techniques.




