Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-02-25
3
Medium Priority
?
518 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 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

879 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