- Forums
- Linux Systems
- How To Tar [Compress] A Directory In Linux With A Shell Command
this tutorial will demonstrate how you can tar or compress a large file or directory into a small tarball using a tar command in a Linux system by following this tutorial you will be able to tar files with these simple command i show step by step [3046], Last Updated: Sat May 18, 2024
wallpaperama
Fri Dec 26, 2008
13 Comments
41030 Visits
this is an example of a tar command i use on my linux server all the time:
tar -pczf www-2008-oct-13.tar.gz www/lets say i want to compress the /var/www directory this is what i would do, i would cd to the /var directory:
cd /var
then i can compress the www/ direcotry and im going to call it backup.tar.gz
tar -pczf backup.tar.gz www/
how how do i untar it? once i have tar it, i can untar it with this command:
tar xvfz backup.tar.gz
hope this helps