On Wed, 11 Feb 2015, gregrwm wrote:

>> When using head or tail with the -c option to specify some number of 
>> bytes, is there any limit to the size of the number that can be used? 
>> I think there might not be a limit, or if there is one it is a number 
>> greater than the size of any file any of us will ever see.  Think so?
>
> good question.  magnitude issues are all too often shrugged off, hence 
> issues like y2k, 2038, not to mention countless buffer overflow security 
> holes.
>
> i've had fun at various times running a loop trying a number, then 10 
> times that number, and so on to see the results, but of course that only 
> tells you the local/current functionality, where the real problem is all 
> too often that no upper limit is even defined, declared, or considered.

I looked at man pages and searched on line, but I forgot to look at the 
info page.  Someone at MSI did that for me and sent me the info below. 
So the answer seems to be that it can go beyond 2^80 and no one will ever 
have file that big....


The man page for 'head' references "info coreutils 'head invocation'" for 
invocation details. Within this man page, is this section:

`-c K'
`--bytes=K'
Print the first K bytes, instead of initial lines. However, if K
starts with a `-', print all but the last K bytes of each file. K
may be, or may be an integer optionally followed by, one of the
following multiplicative suffixes:
`b' => 512 ("blocks")
`KB' => 1000 (KiloBytes)
`K' => 1024 (KibiBytes)
`MB' => 1000*1000 (MegaBytes)
`M' => 1024*1024 (MebiBytes)
`GB' => 1000*1000*1000 (GigaBytes)
`G' => 1024*1024*1024 (GibiBytes)
and so on for `T', `P', `E', `Z', and `Y'.

This indicates very strongly that "-c" can go into Yottabytes
(https://en.wikipedia.org/wiki/Yottabyte).


Mike