Swif’s Live Terminal feature lets administrators open a remote shell session on managed devices in real time. Whether you’re troubleshooting or performing routine checks, Live Terminal provides quick, direct access for Mac, Windows, and Linux.
1. Prerequisites
Admin Access: Any admin who can access the Swif admin portal can use Live Terminal.
Swif Agent Installed: The device must have the Swif Agent installed and connected.
Live Terminal Enabled: If you’ve disabled Live Terminal (see Section 6), you’ll need to re-enable it.
2. Accessing Live Terminal
Go to the Devices tab in the Swif console.
Click the device you want to access.
Then choose Live Terminal.
This opens a terminal window in your browser, creating a remote shell session on the logged-in user’s session for the selected device.
Firefox Users
If you use Firefox, you may need to enable WebSockets over HTTP/2 for Live Terminal to function correctly:
Type
about:config
in the Firefox address bar.Search for
network.http.http2.websockets
.Ensure it is set to true.
3. Supported Platforms
Windows: By default, uses PowerShell in the logged-in user’s session.
macOS: Launches a default shell (e.g., Bash or Zsh).
Linux: Opens a Bash shell by default.
4. Usage Examples
Below are sample commands and scripts you can try to confirm everything works correctly.
4.1 Windows (PowerShell) Examples
Testing a Variable
$testVar = "Hello" if (-not $testVar) { Write-Host "Variable is empty or null" } else { Write-Host "Variable contains data: $testVar" }
Checks if
$testVar
is null or empty, then displays the result.
Testing File Existence
$filePath = "C:\\path\\to\\file.txt" if (Test-Path $filePath) { Write-Host "File exists" } else { Write-Host "File does not exist" }
Uses Test-Path to check if the specified file path is valid.
4.2 macOS (Bash/Zsh) Examples
List Running Processes
ps aux | head -n 5
Displays the top 5 running processes.
Check if a File Exists
FILE=\"/Library/Application Support/MyApp/testfile.txt\" if [ -f \"$FILE\" ]; then echo \"File exists.\" else echo \"File does not exist.\" fi
Verifies the existence of a specific file path on macOS.
System Uptime
uptime
Displays how long the system has been running since last reboot.
4.3 Linux (Bash) Examples
Memory Usage Check
free -h
Shows current memory usage in human-readable format.
CPU Information
lscpu | grep 'Model name'
Prints the CPU’s model name, helpful for confirming hardware.
Check if a Directory Exists
DIR=\"/etc/myapp\" if [ -d \"$DIR\" ]; then echo \"Directory $DIR exists.\" else echo \"Directory $DIR does not exist.\" fi
Checks for a directory at the specified path.
5. Best Practices
Elevated Permissions: Some commands require admin or root privileges. Make sure the logged-in user has sufficient permissions if you need to modify system-critical files or directories.
Idle Sessions: Live Terminal sessions may automatically close if idle for too long.
Security: Limit Live Terminal usage to authorized admins. Actions performed here can affect the system’s stability and security.
6. Disabling Live Terminal (Optional)
If you need to turn off Live Terminal (for instance, due to internal policies), see the article on How to Disable Location Tracking, Live Terminal, and Remote Desktop in Swif for instructions.
That’s it! You now know how to open and use Swif’s Live Terminal in a logged-in user session for Mac, Windows, and Linux. If you have any additional questions, feel free to reach out to Swif Support.