Skip to main content

How to use Live Terminal

Live Terminal opens a remote command line on a managed Mac, Windows, or Linux device, in your browser. Use it to troubleshoot, check settings, or run one-off commands, without signing in to the device.

Important: Live Terminal runs as root or SYSTEM, not as the signed-in user. Commands run with full administrator rights, the same account as the Swif agent. They can change anything on the device. The terminal's header shows which account it's running as.


Requirements

Item

Details

Admin access

Any Swif admin who can open the device can use Live Terminal

Swif agent

Installed on the device, and connected

Live Terminal turned on

For your organization, in Settings > General > Live Terminal


Which account it runs as

Platform

Runs as

Shell

macOS

root

The default shell, such as Zsh or Bash

Windows

SYSTEM

PowerShell

Linux

root

Bash

Live Terminal never runs as the signed-in user. This affects some commands:

  • Home folder: ~ is root's home folder on macOS and Linux, not the user's. On Windows, SYSTEM uses its own profile, not the user's.

  • User settings: commands that read or change a user's settings, such as defaults on macOS, change root's settings unless you specify the user.

  • To run a command as a user, on macOS or Linux, use sudo -u <username> <command>. For example: sudo -u jane defaults read com.apple.dock.

  • On Windows, SYSTEM can't see the user's mapped network drives, or their signed-in apps.


Open Live Terminal

  1. In Swif, go to Devices, and open the device.

  2. Click Live Terminal.

A terminal opens in your browser, connected to the device.

Firefox

Live Terminal needs WebSockets over HTTP/2. If it doesn't connect in Firefox:

  1. Go to about:config.

  2. Search for network.http.http2.websockets.

  3. Set it to true.


Example commands

Windows (PowerShell)

Check whether a file exists:

$filePath = "C:\path\to\file.txt"
if (Test-Path $filePath) { Write-Host "File exists" } else { Write-Host "File does not exist" }

List the 5 processes using the most CPU:

Get-Process | Sort-Object CPU -Descending | Select-Object -First 5

macOS

List running processes:

ps aux | head -n 5

Check whether a file exists:

FILE="/Library/Application Support/MyApp/testfile.txt"
if [ -f "$FILE" ]; then echo "File exists."; else echo "File does not exist."; fi

How long the Mac has been running:

uptime

Linux

Memory use:

free -h

CPU model:

lscpu | grep 'Model name'

Check whether a folder exists:

DIR="/etc/myapp"
if [ -d "$DIR" ]; then echo "Directory $DIR exists."; else echo "Directory $DIR does not exist."; fi


What's recorded

Recorded

Not recorded

Each session that starts. The device's Activity Log shows Connected to live terminal, with the admin who connected, and the time.

The commands typed, and their output. They aren't stored.

When a session ends. The Activity Log shows only the start.

To find sessions, open the device, and go to Activity Log. See Managing Activity Logs and Notes on a Device.

If you need a record of what was done, note it in the session's Activity Log entry, using Add Note.


Who can use Live Terminal

Every admin who can open a device can use Live Terminal on it. It can't be limited to specific admin roles yet.

To turn it off for your whole organization, go to Settings > General > Live Terminal. This stops new sessions. Sessions that are already open stay open until they're closed.


Best practices

  • Check the account first. The terminal's header shows whether you're root or SYSTEM.

  • Be careful with changes. Commands run with full administrator rights, so a mistake can affect the whole device.

  • Close sessions when you're done. Idle sessions may close on their own.

  • Use commands for repeat tasks. To run the same command on many devices, or on a schedule, use Swif's commands instead.


Troubleshooting

A command changed root's settings, not the user's

Live Terminal runs as root. Run the command as the user, with sudo -u <username> <command>, on macOS or Linux.

Live Terminal doesn't connect in Firefox

Turn on network.http.http2.websockets in about:config. See Firefox.

Security software warns about a "reverse shell"

The Live Terminal button is missing

Live Terminal may be turned off for your organization. Check Settings > General > Live Terminal.


Related resources

Did this answer your question?