Cybersecurity Triage
Read-only, sensitive outputShow Recent sudo Commands
You need to see recent sudo commands from auth logs.
Command
grep 'sudo:' logs/auth.log | tail -n 10
Before you run this
System impact: Read-only. Output may expose users, paths, tokens, keys, IPs, process arguments, or log details.
When not to use it: Do not assume all privileged actions use sudo; also inspect service logs and shell history where appropriate.
Expected output
Recent sudo log lines including user, working directory, target user, and command.
System impact
Read-only, sensitive output. Nothing changes. The command filters sudo lines and shows the newest matches in file order.
May require elevated permissions on protected paths or service-owned files.
Recovery / rollback: no state is changed.
When to use it
Use during incident triage or after unexpected service changes.
When not to use it
Do not assume all privileged actions use sudo; also inspect service logs and shell history where appropriate.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ grep 'sudo:' logs/auth.log
Jun 25 12:03:12 vps sudo: alex : TTY=pts/0 ; PWD=/srv/www ; USER=root ; COMMAND=/usr/bin/systemctl reload nginx
Jun 25 12:04:33 vps sudo: deploy : TTY=pts/1 ; PWD=/srv/app ; USER=root ; COMMAND=/usr/bin/journalctl -u app
$ grep 'sudo:' logs/auth.log | tail -n 10
Jun 25 12:03:12 vps sudo: alex : TTY=pts/0 ; PWD=/srv/www ; USER=root ; COMMAND=/usr/bin/systemctl reload nginx
Jun 25 12:04:33 vps sudo: deploy : TTY=pts/1 ; PWD=/srv/app ; USER=root ; COMMAND=/usr/bin/journalctl -u app
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
grep 'sudo:' logs/auth.loggrep 'sudo:' logs/auth.log | tail -n 10
next steps
Related commands
Show Successful Logins and sudo Use
Access reviews need both who logged in and who elevated privileges.
grep -E 'Accepted publickey|sudo:' fixtures/user-access-audit/logs/auth.log
Summarize sudo Commands by User
Privilege history is easier to review when users and commands are separated.
sed -n 's/.*sudo: *\([^: ]*\).*COMMAND=\(.*\)$/\1 -> \2/p' fixtures/user-access-audit/logs/auth.log | sort
Show Accepted SSH Logins
During first response, successful logins matter more than background noise.
grep 'Accepted publickey' logs/auth.log
Review a Breakglass Account
Emergency accounts should be easy to find and hard to ignore.
grep -Rhn 'breakglass' fixtures/user-access-audit/etc fixtures/user-access-audit/home fixtures/user-access-audit/logs
Review sudo Grants
Privilege paths should be visible before you remove or approve access.
awk -F: '$1=="sudo" {print "sudo group: " $4}' fixtures/user-access-audit/etc/group; grep -RhnE '^[^#].*ALL=' fixtures/user-access-audit/etc/sudoers fixtures/user-access-audit/etc/sudoers.d
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.