zcat vs gzcat

Usually we use zcat to check gz files. While today when I was trying to do the same, something strange happend:

Huan$ zcat /Users/Huan/Documents/filename.gz | head
zcat: can't stat: /Users/Huan/Documents/filename.gz (/Users/Huan/Documents/filename.gz.Z): No such file or directory

Of course there is a filename.gz in my Documents directory. However, there is no filename.gz.Z there. But why it is requesting something like that?

It turns out that there’s some discripency between linux and osx (like the carrige returns or anything else!) and that could mess things up. According to this post, “In osx, zcat seems to automatically append .Z to the file name.”, which seems to be what’s happening here. But I’ve been zcating .gz files ALL THE TIME and it is the first time that something like this happend.

The solution is to use gzcat instead of zcat and it worked. But I’m still pretty confused.

Huan Fan /
Published under (CC) BY-NC-SA in categories notes  tagged with Open lab note - OS X 
comments powered by Disqus