List your sudo privileges with `sudo -l`

Before pasting a sudo command from a tutorial, or when writing automation, `sudo -l` shows precisely what your account is allowed to run — and what will be rejected.

LinuxpolicyprivilegessudoauditMedium risk
Run `sudo -l` to print your sudo policy, listing every command you may run, any NOPASSWD entries, and which user you may act as.

01Command

Command
$ sudo -l

02What it does

The output first shows sudoers entries that apply to your account, then 'User X may run the following commands'. An entry like `(ALL : ALL) ALL` means unrestricted access, while `(ALL) NOPASSWD: /usr/bin/systemctl restart nginx` allows only that exact command without a password. To audit another user instead, `sudo -l -U username` lists their privileges without switching accounts. Combined with `sudo -k` (clear the cached credential timestamp) it is also how you re-test a policy change immediately.

03Risk

RiskMedium risk
RequirementsRequires sudo (preinstalled on most distros); membership in sudo/wheel group or a sudoers entry

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-17 · Category: Security & Privacy