GNU bug report logs - #41931
know how to zip a file in gz format.

Previous Next

Package: gzip;

Reported by: Saleh Abdelkerim <abdel.salehbrahim <at> gmail.com>

Date: Thu, 18 Jun 2020 14:32:02 UTC

Severity: normal

Tags: notabug

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41931 in the body.
You can then email your comments to 41931 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gzip <at> gnu.org:
bug#41931; Package gzip. (Thu, 18 Jun 2020 14:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Saleh Abdelkerim <abdel.salehbrahim <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gzip <at> gnu.org. (Thu, 18 Jun 2020 14:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Saleh Abdelkerim <abdel.salehbrahim <at> gmail.com>
To: bug-gzip <at> gnu.org
Subject: know how to zip a file in gz format.
Date: Thu, 18 Jun 2020 10:39:30 +0100
[Message part 1 (text/plain, inline)]
Hello, please excuse me I would like to know how we can compress a set of
files into a file.gz online command under linux because I want to customize
a linux system and I had a problem compressing several files in format gz.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gzip <at> gnu.org:
bug#41931; Package gzip. (Thu, 25 Jun 2020 01:19:01 GMT) Full text and rfc822 format available.

Message #8 received at 41931 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Saleh Abdelkerim <abdel.salehbrahim <at> gmail.com>
Cc: 41931 <at> debbugs.gnu.org
Subject: Re: bug#41931: know how to zip a file in gz format.
Date: Wed, 24 Jun 2020 19:18:40 -0600
tag 41931 +notabug
close 41931
thanks

Hello Saleh,

Saleh Abdelkerim wrote:
> Hello, please excuse me I would like to know how we can compress a set of
> files into a file.gz online command under linux because I want to customize
> a linux system and I had a problem compressing several files in format gz.

The normal tool to use to compress a set of files is 'tar'.  If you
wish to compress a set of files then use tar to do so.  Then compress
the tar file with gzip.

  tar cvf - ./file1 ./file2 ./file3 ./file4 | gzip > ./files.tar.gz

Using tar the above options "cvf -" mean this.

  c    create (instead of appending or other possibilities)
  v    verbosely print out each file as it is processed
  f -  file to output into, "-" is stdout (standard output)

Then it is piped to the next command "| gzip" which compresses the tar
file.  The output is then redirected to a file.  By convention and
tradition the file name would be .tar.gz indicating that it is a
gzip'd tar file.

This is so common of an action that tar has an option specifically for
passing the output through gzip as a typing aide.  It does the exact
same thing as the above.  But it does it internally in order to save
typing.

  tar cvzf ./files.tar.gz ./file1 ./file2 ./file3 ./file4

And reading the output from the tar file back and expanding those
files is done similarly.

  gunzip < ./files.tar.gz | tar xvf -

This also has a typing short cut because it is so often done.

  tar xvzf ./files.tar.gz

To list what is in the files.tar.gz file.

  gunzip < ./files.tar.gz | tar tvf -
  tar tvzf ./files.tar.gz

In my examples I used ./file1 ./file2 ./file3 ./file4 as my example.
The command line shell will also expand wildcards.  And also tar will
read directories.  Therefore using wildcards and directories are also
possible.

  tar cvzf ./files.tar.gz ./adirectory57
  tar cvzf ./files.tar.gz ./*.txt ./*.html

Careful writing an output file into the directory one is compressing.

  tar cvzf ./files.tar.gz .  # WARNING!  Do not do this.

Tools that read directories and writing output to the directory might
start reading their output file endlessly!  In this case make sure the
output file is in a different directory.

  tar cvzf ../files.tar.gz .  # Okay
  tar cvzf /tmp/files.tar.gz .  # Okay

Note that these are but one way out of many ways to do things.  There
are many roads to the same place.  But these are the most common and
most often way to compress many files into one compressed bundle.

Hope that helps!

Bob




bug closed, send any further explanations to 41931 <at> debbugs.gnu.org and Saleh Abdelkerim <abdel.salehbrahim <at> gmail.com> Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Thu, 25 Jun 2020 01:19:02 GMT) Full text and rfc822 format available.

Added tag(s) notabug. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Thu, 25 Jun 2020 01:30:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 23 Jul 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 270 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.