selinuxenabled
linux
Check whether SELinux is enabled. Returns exit code 0 if SELinux is enabled, and 1 if it is not. See also: `getenforce`, `setenforce`, `sestatus`.
More info →Examples (3)
Check if SELinux is enabled (no output; check exit code with `echo $?`)
Check if SELinux is enabled and print the result
selinuxenabled && echo "SELinux is enabled" || echo "SELinux is disabled"made by @shridhargupta | data from tldr-pages