Skip to content

Different Implementations of Commands in Unix-like Systems

Posted on:May 30, 2023

Today I learned while writing some bash script for work that df works differently on Mac and Linux machines.

Although the general purpose of the command is the same across different platforms, the output and some of the arguments are different. It has occurred to me that when running this command: du -sb /foo/bar, this works on the Linux machine that I was ssh-ed into, but not on Mac.

The available command-line options and their behavior may differ. For instance, the -h option on Linux provides human-readable output with units (e.g., “G” for gigabytes), while macOS uses -g instead.