LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-29-2007, 05:22 AM   #1
salmanucit
Member
 
Registered: Jul 2004
Posts: 56

Rep: Reputation: 15
gzip in new file


I have a file abc.txt, when i issue command "gzip abc.txr" it creates a file abc.txt.gz and original abc.txt is deleted. I want to compress abc.txt in a new file and also wants to retain original one. Is it possible? how?
Regards
 
Old 06-29-2007, 05:47 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can use this:
Code:
gzip -c abc.txt > abc.txt.gz
 
Old 06-29-2007, 06:08 AM   #3
salmanucit
Member
 
Registered: Jul 2004
Posts: 56

Original Poster
Rep: Reputation: 15
I have a folder test which has other folders and files in it
I issue following

gzip -cr test > test.gz

It creates my zip file.

Now i decompress it with following

gzip -dr test.gz
OR
gzip -dr test.gz > test

It creates a file (not a folder) test with same saize as my folder test. Is it my folder? id doesn't open as it seems to be a single file.
What am i doing wrong?
Regards
 
Old 06-29-2007, 06:29 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
In this case why don't you use the tar command?
Code:
tar -czvf test.tar.gz test
 
Old 06-29-2007, 11:05 AM   #5
salmanucit
Member
 
Registered: Jul 2004
Posts: 56

Original Poster
Rep: Reputation: 15
Hi
Ok, now this command directly creates a tar + zip file, fair enough. How would i decpmpress it? Remember, on the destination server i also want a direct extraction, i dont want first to decompress and then untar it becaue if i first create a tar file with decompressing it then my this file would take almost 150G size and not i have to untar it and i need another 150G.
So how would i directly decompres sit wihout having an intermediat tar file
Regards

Last edited by salmanucit; 06-29-2007 at 11:19 AM.
 
Old 06-30-2007, 02:42 AM   #6
salmanucit
Member
 
Registered: Jul 2004
Posts: 56

Original Poster
Rep: Reputation: 15
Hi
any one who could help?
Regards
 
Old 06-30-2007, 08:32 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
To decompress it, use the following:
Code:
tar -zxvf test.tar.gz

Last edited by bathory; 06-30-2007 at 08:33 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file creation with gzip sidra Red Hat 1 05-26-2007 07:41 AM
gzip a directory into a file tcma Linux - Software 4 10-07-2004 02:51 AM
untar gzip file problem jmr0311 Linux - General 8 09-12-2004 04:32 PM
linux gzip file by date antonioxcom Linux - Newbie 4 07-12-2004 12:07 AM
How to gzip a file SnowSurfAir Linux - Software 5 07-31-2003 01:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration