How can I determine the size limit of /etc/hosts?
It is a regular file, so the limit would correspond to the underlying filesystem's limits (which would itself be capped by the number of disks behind it), minus the space used by any other files in the same (probably root (/)) filesystem:
- ext2/3: 2 TiB
- ext4: 16 TiB (with the default 4KiB block size)
- xfs: 500 TiB
How can I set the size limit of /etc/hosts?
Since it's a manually-edited file, only manually:
sed -i '100,$d' /etc/hosts
(to remove lines 100 and beyond).