Find the answer to your Linux question:
Results 1 to 9 of 9
hi, a lot of the docs in my debian install come in compressed format (gzipped pdf and dvi files). right now i use sudo to unzip them before opening in ...
  1. #1
    Linux Newbie
    Join Date
    Sep 2007
    Posts
    161

    elegant way to read gzipped documentation?

    hi,

    a lot of the docs in my debian install come in compressed format
    (gzipped pdf and dvi files). right now i use sudo to unzip them before
    opening in a viewer.

    this seem awkward for a number of reasons (superuser powers should not
    be necessary to read docs, the document is left uncompressed wasting
    space and i don't know if other apps expect a .gz file instead of the uncompressed
    file, finally i'd prefer a one step approach).

    is there a default or non-akward way of reading the docs? ideally this would
    uncompress the doc on the fly leaving the original untouched but work with
    one command or pipeline.

    cheers, kai

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by kai12 View Post
    hi,

    a lot of the docs in my debian install come in compressed format
    (gzipped pdf and dvi files). right now i use sudo to unzip them before
    opening in a viewer.

    this seem awkward for a number of reasons (superuser powers should not
    be necessary to read docs, the document is left uncompressed wasting
    space and i don't know if other apps expect a .gz file instead of the uncompressed
    file, finally i'd prefer a one step approach).

    is there a default or non-akward way of reading the docs? ideally this would
    uncompress the doc on the fly leaving the original untouched but work with
    one command or pipeline.

    cheers, kai
    zcat, bzcat, zless and bzless will probably be of use to you.

  3. #3
    Linux Newbie
    Join Date
    Sep 2007
    Posts
    161
    Quote Originally Posted by i92guboj View Post
    zcat, bzcat, zless and bzless will probably be of use to you.
    hi + thanks for the reply!

    it would work, too, if there was a pdf/dvi viewer that read from stdin, but evince, gv, acroread don't.
    or is any way other than going:
    Code:
    zcat somefile.pdf.gz | viewerapp -
    ?

    kai

  4. #4
    Linux Newbie
    Join Date
    Sep 2007
    Posts
    161
    here is an update to my question:

    i just stumbled upon xdvizilla. from the man page:
    xdvizilla was written to look at files and decompress them correctly (depending on their file types).
    this is exactly what i was looking for, running
    Code:
    xdvizilla example.dvi.gz
    will show example.dvi in xdvi.

    alas it's restricted to .dvi files only - there are plenty of .pdf.gz and .ps.gz on my system.
    so i'm still looking for tools to handle those conviniently.

    cheers, kai

  5. #5
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    Quote Originally Posted by kai12 View Post
    hi,

    a lot of the docs in my debian install come in compressed format
    (gzipped pdf and dvi files). right now i use sudo to unzip them before
    opening in a viewer.
    Why would you need root access to unzip a file?! The short answer is you don't. I know Evince supports DVI, as you've mentioned above. Have you tried opening the files directly using it? It does have some support for compression as far as I am aware.
    Last edited by bigtomrodney; 08-01-2008 at 08:15 AM.

  6. #6
    Linux Newbie
    Join Date
    Sep 2007
    Posts
    161
    Quote Originally Posted by bigtomrodney View Post
    Why would you need root access to unzip a file?!
    It's true, I don't. I was thinking of unzipping the file in place (which is
    default behavior for gzip) but, of course, with read privilegdes every
    user can make a local (unzipped) copy. I'd rather not duplicate the
    docs though.

    The short answer is you don't. I know Evince supports DVI, as you've mentioned above. Have you tried opening the files directly using it? It does have some support for compression as far as I am aware.
    I tried evince on a .pdf.gz. It raised an error:
    "Unable to open document - Unhandled MIME type: 'application/x-gzip'"
    and the file was not opened.

    Is there somethink I can do to enable evince to handle this in a better way?

    I keep thinking that there has to be a clever simple way.
    kai

  7. #7
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    Just googling I found this thread on launchpad -

    https://bugs.launchpad.net/ubuntu/+s...138/comments/4
    I can't speak for xpdf (which I don't have around), but evince certainly does, as well as compressed DVI and PS.
    I'm not sure how to do it but it would seem the support is there

    EDIT - Actually that is contradicted further down. I'm going to read more into this.

  8. #8
    Linux Newbie
    Join Date
    Sep 2007
    Posts
    161
    thanks, that was helpful.

    it seems that this behavior of evince (to not open compressed files)
    has been fixed, and it's just my stable Debian system which features an
    old version 0.4.0 (testing, for example, has 2.22.2) of evince.

    i guess i'll be waiting for lenny to become stable later on this year.

    cheer, kai

    PS
    in the meantime, i'll work around using a script like this:
    Code:
    #!/bin/sh
    # wrapper for evince to open compressed (gzipped) content
    
    TMPFILE=`mktemp -p /tmp zevince.XXXX`
    
    zcat "$1" > $TMPFILE
    evince $TMPFILE
    rm $TMPFILE
    Last edited by kai12; 08-01-2008 at 12:48 PM. Reason: added script example

  9. #9
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    My guess is that mc should be able to access all these archive types, then with the correct file association you should be able to view the contents.

    Same for konqueror, provided you have the relevant kio-slaves installed (konqueror should even be able to embed the tools used to display the files, if they are based on kparts).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...