• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 530
  • Last Modified:

linux, how to tar folders and files into a tar.gz file

current_dir
 dir1
 dir2

I am at current dir, and I am trying to tar dir1 and dir2 and all the files that are in therm.
0
rgbcof
Asked:
rgbcof
1 Solution
 
sergiobg57Commented:
tar -cf compressed.tar dirtobecompacted

Open in new window


after generating the .tar file, you just generate de tar.gz:
gzip -9 compressed.tar

Open in new window

0
 
Maciej SsysadminCommented:
As this is linux,you probably have GNU tar, so you can use just one command:
tar czf compressed.tar.gz dir1 dir2

Open in new window

0
 
rgbcofAuthor Commented:
Works great.  Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now