3 ms·
The article wasn't about how to get the size of a file. It was about how linux caches large files. The article just used wc -l as a simple way of loading the en
by axblount 13y ago
The article wasn't about how to get the size of a file. It was about how linux caches large files. The article just used wc -l as a simple way of loading the entire file into memory.
- owenmarshall 13y agoIgnoring that, stat -c%s gives the size of the file in bytes, not a count of newlines. It's always funny to see how the wrong are often so cocksure.
- phaemon 13y agoActually, I'm a little baffled how someone who knows about stat has such an odd idea about how files work. How could you possibly know how many newline characters are in a file without looking in the file?
- damm 13y agoUnless you disable this; ext filesystems normally store this and can be pulled out of 'stat' easily. Sure you can read the whole file and count every line; or you can trust what the filesystem's metadata says it is.
- damm 13y agoWhat version of coreutils are we talking about here? What filesystem mount options do you have?
- damm 13y agoI would think cat would do the same no? or reading the file in $lang?