Show SELinux contexts for a path
Build a paste-ready command, then review its compatibility and effects before running it.
ls -lZ <path> | head -12Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementslsls must be installed and available on PATH.
Version supportls Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsdrwxr-xr-x. root root system_u:object_r:var_log_t:s0 auditRepresentative successful output; values vary with the selected target and system state.
Known errorsls: command not foundls is missing or is not available on PATH.
Verifyls -lZ {{path}} | head -12The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01lsCommandRuns the ls stage of this one-liner.
02-lZOptionConfigures ls with the -lZ option.
03<path>ParameterA value supplied in the Fill parameters section.
04|PipelinePasses the output on the left to the command on the right.
05headCommandRuns the head stage of this one-liner.
06-12OptionConfigures head with the -12 option.
Example input
ls -lZ /var/log | head -12
Example output
drwxr-xr-x. root root system_u:object_r:var_log_t:s0 audit
drwx------. root root system_u:object_r:httpd_log_t:s0 nginx
Illustrative output — exact values vary by system and data.
Official sources