the most common ways to inspect services and roles on Ubuntu.
1. Services (systemd)
Modern Ubuntu uses systemd to manage services.
List all services and their status
bash
systemctl list-units --type=service --all
Show only active (running) services
bash
systemctl list-units --type=service
Check a specific service
bash
systemctl status <service-name>
Example: systemctl status ssh
List services that start on boot
bash
systemctl list-unit-files --type=service
Legacy service command (still works)
bash
service --status-all
+means running-means not running?means status unknown
2. User Roles, Groups, and Permissions
See what groups your current user belongs to
bash
groups
See groups for a specific user
bash
groups username
List all users on the system
bash
cat /etc/passwd
Or more readable:
bash
getent passwd
List all groups on the system
bash
cat /etc/group
Or:
bash
getent group
Check sudo / admin privileges for your user
bash
sudo -l
This shows what commands you are allowed to run with sudo.
Check if a user has sudo access
bash
sudo -l -U username
3. Quick Summary Table
| What you want | Command |
|---|---|
| All services | systemctl list-units --type=service --all |
| Running services | systemctl list-units --type=service |
| My groups / roles | groups |
| All system users | getent passwd |
| All system groups | getent group |
| My sudo permissions | sudo -l |