I have a huge file and want to see its beginning and end. However, when I use head
and tail
, it apparently tries to read the whole file. Since the file is larger than a terabyte, this takes a very long time. Why would the tools do the simple task in such an inefficient way? Is there a reasonable workaround?
The command I'm running is simple tail filename
Edit: Since the question was marked as duplicate, I cannot post a proper answer.
The real reason why head
and tail
were reading the whole file was that the file contained no newline characters. There is a nice workaround by PM 2Ring - using the -c
option and piping the output to hexdump
.
-c
option. Of course, you may want to pipe the output through hexdump or similar. :) – PM 2Ring Nov 19 '14 at 13:22