LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-18-2015, 03:20 AM   #1
pmora
LQ Newbie
 
Registered: Mar 2015
Location: Sevilla, Spain
Distribution: SUSE
Posts: 3

Rep: Reputation: Disabled
gzip -r -c directory > archive.gz


SUSE 11. I have issued the command "gzip -r -c directory > archive.gz" over a complete directory tree. I've got no errors or warnings. I can decompress the gz file also without errors, but what I get is a single file which is the concat of all of the original files, including binaries, without posibility of splitting them into the original ones.

I suppose I've lost my files, no?.

Secondary question: why does gzip let me issue that destructive command?
 
Old 03-18-2015, 03:56 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,401

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally Posted by pmora View Post
I suppose I've lost my files, no?.
Surely you have the original files from before you ran the command or on a valid backup?

Quote:
Originally Posted by pmora View Post
Secondary question: why does gzip let me issue that destructive command?
Because you asked it to do so.


gzip is NOT an archive maker it's a file compressor. That's why you find .tar.gz files or .tgz files. Archives made with tar compressed with gzip
 
Old 03-18-2015, 04:12 AM   #3
pmora
LQ Newbie
 
Registered: Mar 2015
Location: Sevilla, Spain
Distribution: SUSE
Posts: 3

Original Poster
Rep: Reputation: Disabled
The gzip command was followed by a "rm -rf". But I have all backed up previously.

I knew that all, I had all already tested with "zip" command, but tried gzip, saw it compressed better, and changed the command without thinking too much.

I'd like gzip to have said "are you sure of concatting all files into one?" I would do if I had programmed gzip.
 
Old 03-18-2015, 04:16 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,401

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally Posted by pmora View Post
changed the command without thinking too much.
And that's your problem.

Quote:
Originally Posted by pmora View Post
I'd like gzip to have said "are you sure of concatting all files into one?" I would do if I had programmed gzip.
So because you change commands "without thinking too much" someone else should think for you?
 
Old 03-18-2015, 04:25 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,443

Rep: Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774
not to speak about rm -rf, gzip itself did not destroy your original files, but you.
 
Old 03-18-2015, 06:45 AM   #6
pmora
LQ Newbie
 
Registered: Mar 2015
Location: Sevilla, Spain
Distribution: SUSE
Posts: 3

Original Poster
Rep: Reputation: Disabled
So this is a forum for criticizing admins who make a mistake? I didn't know. I will deregister right now. Thanks for your time, and I hope you'll never "bark up the wrong tree" (I don't know wath it means, it's Instant Translator)
 
Old 03-18-2015, 10:19 AM   #7
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
There are various levels of stating and forgiving. If you didn't feel it polite that may be subjective. A little bump does helps.
 
Old 03-18-2015, 11:20 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
Quote:
Originally Posted by pmora View Post
The gzip command was followed by a "rm -rf". But I have all backed up previously.

I knew that all, I had all already tested with "zip" command, but tried gzip, saw it compressed better, and changed the command without thinking too much.

I'd like gzip to have said "are you sure of concatting all files into one?" I would do if I had programmed gzip.
You would find that not working very well in scripts, or cron - where there may be no user attached...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
gzip: stdin: invalid compressed data--format violated; tar: Unexpected EOF in archive mcgao07 Linux - Newbie 1 05-25-2012 01:44 PM
Trying to gzip all my files in one directory then save in another directory Ciik13 Linux - Newbie 2 10-13-2009 06:11 PM
rsnyc backup to gzip archive? j0hnd0e Debian 3 08-04-2007 09:06 AM
Making a bad gzip archive message to appear raklo Linux - Desktop 8 01-01-2007 02:42 AM
gzip a directory into a file tcma Linux - Software 4 10-07-2004 02:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:19 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration