How to Archive files in Linux using Terminal
Using Terminal to Archive files in Linux
Note that:
>> Linux-based Operating Systems are case-sensitive
>> ‘package‘ represents ‘file name‘
>> ‘*’ represents ‘extension‘
This article shows in details how easy it is to archive files, in Kali Linux, Ubuntu, Linux Mint and other Linux-based systems:
1. TAR files
To archive or compress files to “package.tar“, run the command:
tar -cf package.tar file/directory
To show the files as the are being archived/compressed:
tar -cvf package.tar file/directory
Practical Example
root@kali:/home# tar -cvf firefox.tar ./tar/firefox
2. GZIP files
To archive or compress files to package.tar.gz, use the following commands:
tar -czf package.tar.gz
To show the files as the are being archived/compressed:
tar -czvf package.tar.gz
Practical Example
root@kali:/home# tar -czvf firefox.tar.gz ./tar/firefox
3. BZIP2 files
To archive or compress files to package.tar.bz2, use the following commands;
tar -cjf package.tar.bz2
To show the files as the are being archived/compressed:
tar -cjvf package.tar.bz2
Practical Example
root@kali:/home# tar -cjvf firefox.tar.bz2 ./tar/firefox
-c | for creating archives
-v | for verbosely listing files as they are processed
-f | for specifying the file to be archived
-z | for creating gzip archives
-j | for creating bzip files
Achiving Multiple files / directories in the same archive
You can combine more than one file and/or directory in an archive. Just add a space character after the file or directory location.
You can archive as many files and/or directories as you wish in the same archive.
Practical Example
Archiving Tor Browser and Firefox Browser in the archive “torbundle.tar.gz“
root@kali:/home# tar -czvf torbundle.tar.gz ./tar/tor-browser_en-US ./tar/firefox
If you are not the biggest fan of commands, again like stated on the Linux Archive Extraction article, you are also sorted. Just use the inbuilt Archive Manager in your Linux OS. Note that the Archive Manager may be limited (not very resourceful) when it comes to archiving unlike unarchiving.
NOTE:// Be careful with Commands. They are very easy, fast and fun to use but they can also cause great damage fast!
How to Archive files using Terminal in Linux
Hacking | thetqweb