I am trying to understand why wc and stat report different things for /proc/[pid]/cmdline.
wc says my shell's cmdline file is 6 bytes in size:
$ wc --bytes /proc/$$/cmdline
6 /proc/10425/cmdline
stat says the file is 0 bytes in size:
$ stat --format='%s' /proc/$$/cmdline
0
file agrees with stat:
$ file /proc/$$/cmdline
/proc/10425/cmdline: empty
cat gives this output:
$ cat -vE /proc/$$/cmdline
-bash^@
All of this is on Linux rather than on any other *nix OS.
Do the stat and wc programs have a different algorithm for computing the number of bytes in a file?
du. It shows space used on disk, which can be different fromstat