Skip to content

Commit a81d833

Browse files
authored
selinuxenabled: add page (#18444)
1 parent ba44554 commit a81d833

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pages/linux/selinuxenabled.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# selinuxenabled
2+
3+
> Check whether SELinux is enabled.
4+
> Returns exit code 0 if SELinux is enabled, and 1 if it is not.
5+
> See also: `getenforce`, `setenforce`, `sestatus`.
6+
> More information: <https://manned.org/selinuxenabled>.
7+
8+
- Check if SELinux is enabled (no output; check exit code with `echo $?`):
9+
10+
`selinuxenabled`
11+
12+
- Check if SELinux is enabled and print the result:
13+
14+
`selinuxenabled && echo "SELinux is enabled" || echo "SELinux is disabled"`
15+
16+
- Use in a shell script to conditionally execute commands:
17+
18+
`if selinuxenabled; then echo "SELinux is running"; fi`

0 commit comments

Comments
 (0)