Skip to content

Instantly share code, notes, and snippets.

@coolaj86
Last active October 20, 2023 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolaj86/1759b70e72f038869b7bf87816d9dc2e to your computer and use it in GitHub Desktop.
Save coolaj86/1759b70e72f038869b7bf87816d9dc2e to your computer and use it in GitHub Desktop.
POSIX, BSD, GNU, & IEEE Standard Command Line Flags & Options

POSIX & BSD Standard Command Line Flags & Options

The vital resource for developers creating new command-line tools to learn the wisdom of the ancients.

All programs should universally implement these flags:

  • -V (uppercase), --version, version
  • --help, help (also the default if nothing is given)
  • -- stop processing flags; treat all else as raw arguments

Depending on whether a program primarily interacts with a network, text data, or binary data, it may use these differently:

  • -a, --all
  • -A, --almost-all
  • -c, --config, --count
  • -d, --delimiter, --data
  • -E, --extended-regexp
  • -F, --fixed-strings (no regexp)
  • -v, --verbose or --invert-match
  • -h, --human-readable (use suffixes such as k, m, and b for large numbers)
  • -i, --input (file to read from), --insensitive (case insensitive) or --index (starting value)
  • -f, --force, --field
  • -k, --insecure
  • -l, --list
  • -u, --unignore, --user
  • -p, --port, --preserve (permissions), --password
  • -r, --recursive, --raw
  • -q, --quiet
  • -F, classify
  • -I, --ignore
  • -s, --silent
  • -y, --yes (auto-accept)
  • -n, number or count
  • -o, --out (file to write to)
  • -w, --write (replace in-place)
  • -u, --unix (formatting, e.g. of time)
  • -O, --log
  • -4, ipv4
  • -6, ipv6
  • -0, use C-string NULL as delimiter

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment