Skip to content
shellmap

get-serviceList installed Windows services — like systemctl status across all 5 shells

Equivalents in every shell

Bashunix
systemctl list-units --type=service

On modern Linux (systemd-based: most distros since 2015), `systemctl` is canonical. `systemctl list-units --type=service --state=running` for active services; `systemctl status <name>` for a single one. Pre-systemd shows `service --status-all` (SysV-init) or `initctl list` (Upstart). On non-systemd containers, `ps` is your friend — there is no service manager.

Zshunix
launchctl list

macOS uses `launchd`, not systemd. `launchctl list` (per-user) and `sudo launchctl list` (system) show services with PID, exit code, and label. Service definitions live in `~/Library/LaunchAgents/` (per-user), `/Library/LaunchAgents/` (system, user-context), `/Library/LaunchDaemons/` (system, root-context). Modern macOS (12+) prefers `launchctl print system/<service>`.

Fishunix
systemctl list-units --type=service

Same external `systemctl` / `launchctl` binaries. Fish has no native service abstraction.

PowerShellwindows
Get-Service

PowerShell-native cmdlet. Returns `[System.ServiceProcess.ServiceController]` OBJECTS — `.Status`, `.StartType`, `.DisplayName`, `.DependentServices`, `.ServicesDependedOn`. Filter at the cmdlet level: `Get-Service -Name "wuauserv"`, `Get-Service | Where-Object Status -eq Running`. Use `-ComputerName host` (PS 5.1 only; removed in PS 6+) for remote query.

cmd.exewindows
sc query

Built-in `sc` (service controller). `sc query` lists running services; `sc query state= all` shows everything; `sc query <name>` for one. Note the SPACE after `state=` — sc parses `key= value` not `key=value`. For richer output `sc queryex <name>` adds PID, flags, start type. `net start` (no args) lists running services in a friendlier format.

Worked examples

List all running services

Bash
systemctl list-units --type=service --state=running
Zsh
sudo launchctl list | grep -v "^-"
PowerShell
Get-Service | Where-Object Status -eq Running
cmd.exe
net start

Show status of a specific service

Bash
systemctl status nginx
PowerShell
Get-Service -Name w3svc
cmd.exe
sc query w3svc

List services with a name pattern

Bash
systemctl list-units "ssh*" --type=service
PowerShell
Get-Service -Name "Win*"

Gotchas

  • `Get-Service` on PowerShell 6+ removed the `-ComputerName` parameter — to query a remote box use `Invoke-Command -ComputerName host { Get-Service }`. Scripts written for Windows PowerShell 5.1 that rely on `Get-Service -ComputerName` silently degrade on cross-platform pwsh (parameter not found), even though the cmdlet itself works.
  • macOS 13+ migrated user agents to the `launchctl bootstrap` / `launchctl bootout` API — old `launchctl load` / `unload` still work but emit deprecation warnings. The user-domain target is `gui/$(id -u)`, the system-domain is `system`. New scripts should spell the domain explicitly: `launchctl print gui/$(id -u)/com.example.svc`.
  • systemd `systemctl status <name>` returns NON-ZERO exit code when the service is stopped (3) or failed (3) — surprising in `set -e` shell scripts. For "is it running, yes/no" checks use `systemctl is-active --quiet <name>` (exit 0 when active, non-zero otherwise) — the documented stable contract.
  • `Get-Service` returns ALL services regardless of permissions, but accessing properties of services owned by SYSTEM (`.UserName`, certain registry paths) requires elevation. `Get-Service` itself works in a non-elevated session; `Set-Service` / `Start-Service` / `Stop-Service` typically need elevation. The split surprises Linux admins used to needing sudo just to read.
  • cmd `sc query` truncates service display names to 80 columns and silently. For a complete picture pipe through `findstr` or just use `Get-Service` from PowerShell. The `sc` binary on Windows is unrelated to the `sc` package on some Unix distros (source-code-control); never confuse the two if scripting cross-platform.

WSL & PowerShell Core notes

pwshOn Linux/macOS pwsh, `Get-Service` exists but is largely a no-op shim — it returns Windows-only services (none on a Linux host). The cross-platform answer is to call the native service manager: `& systemctl list-units --type=service` from pwsh on Linux, `& launchctl list` from pwsh on macOS. There is no provider that wraps systemd / launchd as PS cmdlets in the box.
WSLWSL2 distros run systemd (since WSL 0.67.6 with `systemd=true` in `/etc/wsl.conf`); WSL1 does not. From Windows pwsh, `wsl systemctl list-units` queries the WSL distro's services — completely separate from Windows-host services. To list Windows services from inside WSL, `pwsh.exe -c Get-Service` over interop.

Related commands