LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

selinuxenabled

Check if SELinux is enabled on the system

TLDR

Check if SELinux is enabled (no output)
$ selinuxenabled
copy
Check and print result
$ selinuxenabled && echo "SELinux is enabled" || echo "SELinux is disabled"
copy
Use in shell script conditionally
$ if selinuxenabled; then echo "SELinux is running"; fi
copy

SYNOPSIS

selinuxenabled

DESCRIPTION

selinuxenabled checks whether SELinux is enabled on the system. It produces no output but returns exit code 0 if SELinux is enabled, and 1 if it is disabled.This is useful for scripts that need to conditionally execute commands based on SELinux status.

INSTALL

sudo apt install selinux-utils
copy
sudo dnf install libselinux-utils
copy
sudo apk add libselinux-utils
copy

CAVEATS

Only checks if SELinux is enabled, not whether it's in enforcing or permissive mode. Use getenforce for mode information.

HISTORY

Part of libselinux-utils, providing SELinux status checking utilities.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid