[Wylug-help] I broke my man files

Aaron Crane wylug at aaroncrane.co.uk
Wed Dec 7 21:36:08 GMT 2005


RichardA writes:
> I was trying to get text versions of them, forgot to work on copies
> instead of the originals, and I think I overwrote them with ungzipped
> versions:
> 
> $ man ls
> gzip: /usr/share/man/man1/ls.1.gz: not in gzip format

Something like this (untested) should get you started:

  for f in /usr/*/man/man*/*.gz; do
    if file -b "$f" | grep -wqv gzip; then
      mv -i "$f" "${f%.gz}" &&
      gzip -9 "${f%.gz}"
    fi
  done

You'll need to run that as root.  I'm guessing that you were running as
root when you made this mistake, so that might not be advice you need
for the repair -- but, if so, this should be a good (if unpleasant)
demonstration of the dangers of running ordinary commands while you have
root privileges.

-- 
Aaron Crane



More information about the Wylug-help mailing list