List the commands the current user is allowed or denied to run through sudo.
Do not run an administrative command.
Which command is appropriate?
sudo -l lists Defaults and the sudo policy that applies to the current user on the current host.
Detailed explanation
sudo -vIncorrect. -v validates credentials and updates the timestamp.
Incorrect. -v validates credentials and updates the timestamp.
sudo -kIncorrect. -k invalidates the cached credential timestamp.
Incorrect. -k invalidates the cached credential timestamp.
sudo -lCorrect. -l lists applicable sudo permissions.
Correct. -l lists applicable sudo permissions.
su -Incorrect. su - starts another user's login shell.
Incorrect. su - starts another user's login shell.
Try it yourself
An example you can run in a temporary verification environment.
sudo --help 2>&1 | grep -E -- '-l|--list' | head -n 1Expected result
-lまたは--listの説明行Key points
- -l means list
- -v validates credentials
- Inspect policy
Notes
- Environment: sudo help / privilege command実行なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.