To begin, "Tape Archiver" (TAR) is used to archive files. There are three tasks important to the RHCSA exam, when it comes to knowing how to archive. You should know how to:
- Create an archive
- List the contents of an archive
- Extract an archive
To create an archive using TAR, you want to use the command:
tar cf(v if you want to see what's happening) archivename.tar /files-you-want-to-archive
Example: (must be root) tar cvf /root/homes.tar /home
To add a file to an archive you would use the r modifier.
Example: tar rvf /root/homes.tar /etc/hosts
To update it, use the u modifier.
To extract the archive, use the x modifier.
To see the contents of an archive type use the t modifier.
Now, you're probably all wonder, "when do we get to the compression". Well interestingly enough, back then this wasn't really used for compression. There was an add-on to the program called gzip, and it got so popular, that now it's implemented in TAR by default. Nowadays, compression is all it's used for. Here's how to do it:
When you're creating your archive, add the modifier -z and it will compress it when archiving your files. However, if you have already archived your files and you want to compress it, a command like this would work:
That's all there is to it! Thanks for reading, and I hope this helped.
No comments:
Post a Comment