Solved

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

Posted on 2011-02-25
3
490 Views
Last Modified: 2012-05-11
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
Comment
Question by:rgbcof
3 Comments
 
LVL 3

Expert Comment

by:sergiobg57
ID: 34982682
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
 
LVL 23

Accepted Solution

by:
Maciej S earned 250 total points
ID: 34982760
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
 

Author Closing Comment

by:rgbcof
ID: 34982865
Works great.  Thanks
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question