// CyberGrind · Orange Book · OS Infographic Series — 09 of 09
zsh commands, macOS-specific BSD utilities, Homebrew, and key differences from Linux bash.
sed -i '' requires empty string after -i on macOS (BSD), but not on Linux (GNU). This breaks Linux scripts on Mac. Install GNU coreutils via Homebrew for full compatibility.ls -lah -Gopen file.pdf | open -a Safari urlopen . opens current folder in Finder.pbcopy < file.txt | pbpastecat file | pbcopy copies file content.mdfind "kMDItemKind == 'PDF'"sed -i '' 's/old/new/g' file.txtlsof -iTCP -sTCP:LISTEN -n -Psw_vers | diskutil listdefaults write com.apple.Finder AppleShowAllFiles YES| Task | macOS (BSD) | Linux (GNU) |
|---|---|---|
| In-place sed | sed -i '' 's/x/y/g' file | sed -i 's/x/y/g' file |
| Colorized ls | ls -G | ls --color=auto |
| Listening ports | lsof -iTCP -sTCP:LISTEN | ss -tlnp |
| Network interfaces | ifconfig / networksetup | ip addr show |
| Service management | launchctl (launchd) | systemctl (systemd) |
| File metadata search | mdfind (Spotlight) | locate / find |
| Open in GUI | open file.pdf | xdg-open file.pdf |
| Clipboard | pbcopy / pbpaste | xclip / xsel |
| System version | sw_vers | uname -a / lsb_release |
| RAM info | sysctl -n hw.memsize | free -h |
| Install packages | brew install package | apt / dnf / pacman |
| Default shell | zsh (Catalina+) | bash (most distros) |