Skip to main content
Add link to @b01's answer
Source Link
chbrown
  • 947
  • 6
  • 9

BSD's (Mac OS X'smacOS's) stat has a different format argument flag, and different field specifiers. From man stat(1):

  • -f format: Display information using the specified format. See the FORMATS section for a description of valid formats.
  • ... the FORMATS section ...
  • z: The size of file in bytes.

So all together now:

stat -f%z myfile1.txt

NOTE: see @b01's answer for how to use the stat command on GNU/Linux systems. :)

BSD's (Mac OS X's) stat has a different format argument flag, and different field specifiers. From man stat(1):

  • -f format: Display information using the specified format. See the FORMATS section for a description of valid formats.
  • ... the FORMATS section ...
  • z: The size of file in bytes.

So all together now:

stat -f%z myfile1.txt

BSD's (macOS's) stat has a different format argument flag, and different field specifiers. From man stat(1):

  • -f format: Display information using the specified format. See the FORMATS section for a description of valid formats.
  • ... the FORMATS section ...
  • z: The size of file in bytes.

So all together now:

stat -f%z myfile1.txt

NOTE: see @b01's answer for how to use the stat command on GNU/Linux systems. :)

Source Link
chbrown
  • 947
  • 6
  • 9

BSD's (Mac OS X's) stat has a different format argument flag, and different field specifiers. From man stat(1):

  • -f format: Display information using the specified format. See the FORMATS section for a description of valid formats.
  • ... the FORMATS section ...
  • z: The size of file in bytes.

So all together now:

stat -f%z myfile1.txt