Guides › Desktop and apps

Terminal

Open the Terminal, type commands in the Sovereign shell, and write simple scripts.

The Terminal is a window where you type commands instead of clicking. It runs the Sovereign shell, the system's own command language. You never need the Terminal for everyday use, but it can be quicker for some jobs.

Open the Terminal

Do any one of these:

  • Press Ctrl + Alt + T.
  • Click Terminal on the taskbar, or find it in Start.
  • Press Logo key + X and choose Terminal.
  • Press Logo key + R, type cmd and press Enter.

The Terminal shows a prompt like PS C:\Accounts\alex>. The part after PS is the folder you are in. Type a command after the > and press Enter.

Type your first commands

  1. Type help and press Enter. You see every command, grouped by what it does.
  2. Type dir and press Enter. You see the files and folders in the current folder.
  3. Type cd Documents and press Enter. The prompt changes to show you are now in Documents.
  4. Type cd .. and press Enter to go back up one folder.
  5. Type cls to clear the screen.

Some tips:

  • Command names ignore upper and lower case, so DIR and dir are the same.
  • Paths use drive letters and backslashes, like D:\Music. Type D: alone to switch to drive D. See Files and drives.
  • Press Tab to finish a command or file name you started typing.
  • Press Up and Down to bring back commands you typed before.
  • Press Ctrl + C to cancel what you are typing, or to stop a command that is still running.
  • Put quotes around paths with spaces: cd "C:\Shared Data".

Common commands

Most commands have a long name and short names. Either works.

Files and folders

CommandWhat it does
dir (gci, Get-ChildItem)List a folder. Add -Recurse for subfolders, -Filter *.txt for only some files
cd (Set-Location)Change folder: cd D:\Music, cd .., cd \
Get-Location (pwd)Show the current folder
type (Get-Content)Show what is in a file. -Head 10 or -Tail 10 show the first or last lines
copy FROM TO (Copy-Item)Copy a file or folder
move FROM TO (Move-Item)Move a file or folder
ren PATH NEWNAME (Rename-Item)Rename a file or folder
del (Remove-Item)Delete files. -Recurse deletes a folder and everything in it
md NAMEMake a folder
rd NAMERemove a folder (-Recurse when it is not empty)
Test-Path PATHCheck whether a file or folder is there
Get-PSDriveList the drives, with used and free space
start PATHOpen a file in its app, a folder in Files, or an app

Text

CommandWhat it does
echo (Write-Output)Print text. Add > file.txt to write it to a file, >> file.txt to add to the end
findstr (Select-String)Find text in files, or in what another command printed
Measure-ObjectCount lines, words and characters

This computer

CommandWhat it does
systeminfoA summary of this computer
verThe system version
Get-Date, Get-UptimeThe date and time, and how long the computer has been on
tasklist (Get-Process)List running programs
taskkill /PID ID (Stop-Process)Stop a program by its number
hostname, whoamiThe computer name, and who you are signed in as
Get-HistoryCommands typed so far
Restart-Computer, Stop-Computer, Suspend-ComputerRestart, shut down or sleep

Network

CommandWhat it does
ipconfigYour network addresses (/all for more)
ping HOSTCheck that another computer answers
Get-NetAdapter (net)Network adapters and addresses
Invoke-WebRequest URL -OutFile FILEDownload a file

Commands only Sovereign OS has

CommandWhat it does
ask QUESTION (Invoke-Assistant)Ask the Assistant
Get-Model, Find-Model, Save-Model, Set-ModelList, search, download and switch language models
Set-KeyboardLayout, Set-DisplayLanguageKeyboard layouts and display language
Get-DeveloperModeWhether Developer Mode is on
distroList, install, start and stop Linux distros

Type help for the full list, and where NAME to see what a command name runs.

Use tabs

  • Click the plus button in the tab strip, or press Ctrl + Shift + T, for a new tab.
  • Press Ctrl + Shift + W to close a tab, or click its close mark.
  • Press Ctrl + Tab to move to the next tab, or Alt + 1 to 9 to jump to one.
  • Right-click the plus button, or press Ctrl + Shift + P, for a list of shells to open in a new tab.
  • Press Ctrl + Shift + V to paste text.
  • Scroll with the mouse wheel, or Shift + Page Up and Shift + Page Down.

Run a command as administrator

Some commands change the whole system and need an administrator. This is off until you turn it on.

  1. Open Settings > System > Advanced.
  2. Turn on Run as administrator in the Terminal.
  3. In the Terminal, type elevate, a space, and then the command you want to run.
  4. A box asks Allow this change? Choose an administrator, type their password and click Yes.

The password is remembered for 5 minutes, in that tab only. elevate -Shell makes the whole tab an administrator shell until you type exit. elevate -Help lists the other options.

Write and run a script

A script is a text file with commands, one per line, that run in order. Scripts end in .ps1.

  1. Open Text Editor.
  2. Type the three lines shown below, each on its own line.
  3. Save the file as hello.ps1 in your Documents folder.

The three lines:

  • $name = Read-Host "What is your name"
  • echo "Hello $name"
  • Start-Sleep 2

Now run it:

  1. In the Terminal, type cd Documents and press Enter.
  2. Type .\hello.ps1 and press Enter.
  3. The script asks for your name. Type it and press Enter. The script greets you.

What the lines mean:

  • $name = value keeps a value under a name. $name uses it later.
  • Read-Host asks you to type something.
  • Start-Sleep 2 waits two seconds.

You can also run a script by its full path with & "C:\path\script.ps1". Running it with . .\script.ps1 keeps its values in your shell after it ends.

Developer tools

The Terminal also has kpkg to install Store apps by typing, kdbg to debug a program and kprof to see where a program spends its time. See Developer tools in the Terminal.

Linux commands

Commands like ls, grep or sudo are Linux commands, not commands of this shell. If you type one, the Terminal tells you so.

Once a Linux distro is installed and running, the tab strip shows a Connect to Linux button. It opens a new tab in that distro's own shell, where Linux commands and paths work as usual. To make new Terminals open the Linux shell, open Settings > System > Advanced and set Terminal to Linux distro shell. See Linux programs.

If something goes wrong

  • "Running commands as administrator from the Terminal is off." Turn on Run as administrator in the Terminal as shown above.
  • A command seems stuck. Press Ctrl + C.
  • A file name is not found. Check the folder with Get-Location, and use quotes around names with spaces.

Still stuck? Search the help center or contact support.