Link to home
Start Free TrialLog in
Avatar of singh101
singh101

asked on

How to use the tar command to tar up a directory

I have a directory called webapps, all the contents  i need to compress into a tar file.  How can I do this? Should I use tar or gzip which is the better solution?
SOLUTION
Avatar of Andre Thibodeau
Andre Thibodeau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gundares
Gundares

You can also gzip (or bzip2) your archive using only one 'tar' command like this:

$ tar -zcf webapps.tar.gz webapps
$ tar -jcf webapps.tar.bz2 webapps

These commands assume that your current folder is one level upper that your 'webapps' folder
Avatar of singh101

ASKER

tar -zcf webapps.tar.gz webapps
when I run this command it is returning tar: z unknown function modifier. ideally I want to tar up the contents of webapps and not the webapps folder. If I cd to webapps and then replace . with webapps. Is that ok?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial