[Linux] Caution: using command 'less' on gzipped file
A couple of years ago, I found that I can use Linux command less to view gzipped file, such as:
|
|
This is very convenient to view gzipped file content.
However, recently, I noticed a problem with it. For a file which has 42196516 lines, if I opened it with less, it gave me a count of 30356021 lines:
|
|
Therefore, gzip -dc gives correct answer while less truncates the input stream.
In conclusion, for safety, always use gzip, other than less, to open gzipped files.
Last modified on 2019-12-27