whatis posix

POSIX

Also known as: Portable Operating System Interface

An IEEE standard defining the shell, utilities, and system APIs a Unix-like OS should provide so scripts and programs stay portable.

What Is POSIX in Linux?

POSIX specifies how things like sh, test, find, file permissions, signals, and the C system interface must behave. Linux is not formally certified, but it is POSIX-compatible in practice, which is why software moves easily between Linux, the BSDs, and macOS.

For shell scripting, "POSIX sh" means avoiding bash-only features like arrays and [[ ]]. Scripts that start with #!/bin/sh should stick to POSIX, since on Debian and Ubuntu that path points to dash, not bash.

Example

#!/bin/sh
[ -f "$1" ] && echo "exists"