Skip to main content
serg
Source Link
Cyclic3
  • 930
  • 8
  • 24

For a normal file, ls and wc call stat. However, for a file of /proc or /sys, ls returns 0, but wc returns a different number:

$ cd /proc
$ ls -l | grep /proc/modules
-r--r--r--  1 root root 0 Jan 16 14:56 modules
                        ^ this one
$ wc -c /proc/modules
7621 modules

This is probably some way of finding out if something is a special file.

For a normal file, ls and wc call stat. However, for a file of /proc or /sys, ls returns 0, but wc returns a different number:

$ cd /proc
$ ls -l | grep modules
-r--r--r--  1 root root 0 Jan 16 14:56 modules
                        ^ this one
$ wc -c modules
7621 modules

This is probably some way of finding out if something is a special file.

For a normal file, ls and wc call stat. However, for a file of /proc or /sys, ls returns 0, but wc returns a different number:

$ ls -l /proc/modules
-r--r--r--  1 root root 0 Jan 16 14:56 modules
                        ^ this one
$ wc -c /proc/modules
7621 modules

This is probably some way of finding out if something is a special file.

Source Link
Cyclic3
  • 930
  • 8
  • 24

For a normal file, ls and wc call stat. However, for a file of /proc or /sys, ls returns 0, but wc returns a different number:

$ cd /proc
$ ls -l | grep modules
-r--r--r--  1 root root 0 Jan 16 14:56 modules
                        ^ this one
$ wc -c modules
7621 modules

This is probably some way of finding out if something is a special file.