Solved

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

Posted on 2011-02-25
3
489 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

867 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now