Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-02-25
3
Medium Priority
?
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 1000 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

A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

Question has a verified solution.

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

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…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

721 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