Skip to main content

Terminal & CLI

PowerShell, Windows Terminal, and command-line tools for Linux users transitioning to Windows environments.

Windows Terminal

Windows Terminal vs Linux Terminals

FeatureWindows TerminalLinux (GNOME Terminal)Linux (Konsole)
TabsYesYesYes
Split panesYesLimitedYes
ProfilesMultiple shellsOne shellMultiple profiles
ThemesJSON configurationGUI settingsGUI settings
GPU accelerationYesLimitedYes
Background imagesYesLimitedYes

Installing Windows Terminal

# Install from Microsoft Store (recommended)
# Or install via winget
winget install Microsoft.WindowsTerminal

# Or install via chocolatey
choco install microsoft-windows-terminal

Windows Terminal Shortcuts

ActionShortcutLinux Equivalent
New tabCtrl + Shift + TCtrl + Shift + T
Close tabCtrl + Shift + WCtrl + Shift + W
Switch tabsCtrl + TabCtrl + Page Up/Down
Split pane horizontallyAlt + Shift + -Ctrl + Shift + O
Split pane verticallyAlt + Shift + +Ctrl + Shift + E
Switch panesAlt + Arrow keysAlt + Arrow keys
New windowCtrl + Shift + NCtrl + Shift + N
CopyCtrl + Shift + CCtrl + Shift + C
PasteCtrl + Shift + VCtrl + Shift + V

Windows Terminal Configuration

Configuration is stored in JSON format (similar to VS Code):

%USERPROFILE%\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json

Access settings: Ctrl + ,

PowerShell for Linux Users

PowerShell vs Bash Comparison

ConceptPowerShellBashNotes
PhilosophyObject-orientedText-basedPowerShell works with .NET objects
Case sensitivityCase-insensitiveCase-sensitiveCommands and parameters
Variables$variable$variableSimilar syntax
Command outputObjectsTextMajor difference
PipingObject propertiesText streamsDifferent capabilities
Help systemGet-HelpmanBuilt-in documentation

PowerShell Command Structure

# Verb-Noun pattern
Get-Process # Like ps aux
Set-Location # Like cd
Copy-Item # Like cp

# Parameters
Get-Process -Name "chrome"
Get-ChildItem -Path "C:\" -Recurse

Basic Commands Translation

TaskPowerShellBashAlias Available
List filesGet-ChildItemlsls, dir
Change directorySet-Locationcdcd
Copy filesCopy-Itemcpcp, copy
Move filesMove-Itemmvmv, move
Delete filesRemove-Itemrmrm, del
Show contentGet-Contentcatcat, type
Create directoryNew-Item -ItemType Directorymkdirmkdir, md
Current locationGet-Locationpwdpwd, gl
Process listGet-Processpsps
Find textSelect-StringgrepNo direct alias

PowerShell Aliases

PowerShell includes many Linux-like aliases:

# View all aliases
Get-Alias

# Common Linux aliases that work
ls # Get-ChildItem
pwd # Get-Location
cd # Set-Location
cp # Copy-Item
mv # Move-Item
rm # Remove-Item
cat # Get-Content
ps # Get-Process
kill # Stop-Process

Variables and Environment

TaskPowerShellBash
Set variable$var = "value"var="value"
Use variable$var$var
Environment variable$env:PATH$PATH
Set env variable$env:VAR = "value"export VAR="value"
List env variablesGet-ChildItem env:env or printenv

PowerShell Object Pipeline

# Get processes, filter by CPU usage, select properties
Get-Process | Where-Object {$_.CPU -gt 10} | Select-Object Name, CPU

# Linux equivalent (text processing)
ps aux | awk '$3 > 10 {print $11, $3}'

PowerShell Scripting Basics

# Script file extension: .ps1

# Conditional
if ($condition) {
Write-Host "True"
} else {
Write-Host "False"
}

# Loop
foreach ($item in $collection) {
Write-Host $item
}

# Function
function Get-SystemInfo {
Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion
}

Command Prompt (Legacy)

Command Prompt vs PowerShell

FeatureCommand PromptPowerShellRecommendation
ObjectsNoYesUse PowerShell
AliasesLimitedExtensiveUse PowerShell
ScriptingBatch filesPowerShell scriptsUse PowerShell
Error handlingLimitedAdvancedUse PowerShell
Help systemBasicComprehensiveUse PowerShell

When to Use Command Prompt

  • Legacy batch scripts
  • System administration tools that require it
  • Simple file operations (if you prefer)

Command Prompt Commands

TaskCommandLinux Equivalent
Directory listingdirls
Change directorycdcd
Copy filescopycp
Move filesmovemv
Delete filesdelrm
Create directorymkdirmkdir
Remove directoryrmdirrmdir
Display filetypecat

Package Managers

Chocolatey (Third-party)

Windows package manager similar to apt/yum/pacman.

Installation:

Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Usage:

TaskChocolateyLinux (apt)Linux (yum)
Install packagechoco install packageapt install packageyum install package
Uninstall packagechoco uninstall packageapt remove packageyum remove package
Update packagechoco upgrade packageapt upgrade packageyum update package
Update allchoco upgrade allapt upgradeyum update
Search packagechoco search packageapt search packageyum search package
List installedchoco list --local-onlyapt list --installedyum list installed

Windows Package Manager (winget)

Microsoft's official package manager.

Usage:

TaskwingetLinux (apt)
Installwinget install packageapt install package
Uninstallwinget uninstall packageapt remove package
Updatewinget upgrade packageapt upgrade package
Update allwinget upgrade --allapt upgrade
Searchwinget search packageapt search package
Listwinget listapt list --installed

Scoop (Alternative package manager)

Focused on command-line tools and development software.

Installation:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex

Usage:

scoop install git
scoop install nodejs
scoop bucket add extras
scoop install vscode

File and Text Processing

PowerShell File Operations

# Read file content
Get-Content file.txt

# Write to file
"Hello World" | Out-File file.txt

# Append to file
"New line" | Add-Content file.txt

# Count lines
(Get-Content file.txt).Count

# Get file info
Get-ItemProperty file.txt

Text Processing Comparison

TaskPowerShellLinux
Search textSelect-String "pattern" file.txtgrep "pattern" file.txt
Replace text(Get-Content file.txt) -replace "old", "new" | Set-Content file.txtsed 's/old/new/g' file.txt
Count lines(Get-Content file.txt).Countwc -l file.txt
Sort linesGet-Content file.txt | Sort-Objectsort file.txt
Unique linesGet-Content file.txt | Sort-Object -Uniquesort -u file.txt
Head/tailGet-Content file.txt -Head 10 / -Tail 10head -10 file.txt / tail -10

PowerShell CSV Processing

# Import CSV
$data = Import-Csv data.csv

# Filter and export
$data | Where-Object {$_.Status -eq "Active"} | Export-Csv filtered.csv

# Group and count
$data | Group-Object Department | Select-Object Name, Count

Network Commands

Network Diagnostics

TaskWindowsLinuxPowerShell
Pingping hostnameping hostnameTest-Connection hostname
Traceroutetracert hostnametraceroute hostnameTest-NetConnection -TraceRoute
DNS lookupnslookup hostnamedig hostnameResolve-DnsName hostname
Network configipconfigifconfig / ip addrGet-NetIPAddress
Network connectionsnetstatnetstat / ssGet-NetTCPConnection
ARP tablearp -aarp -aGet-NetNeighbor

PowerShell Network Commands

# Test network connectivity
Test-NetConnection google.com -Port 80

# Get network adapters
Get-NetAdapter

# Get IP configuration
Get-NetIPConfiguration

# Test DNS resolution
Resolve-DnsName google.com

# Get network statistics
Get-NetStatistics

System Information

System Information Commands

InformationWindowsLinuxPowerShell
System infosysteminfouname -aGet-ComputerInfo
Hardware infomsinfo32lshwGet-WmiObject Win32_ComputerSystem
CPU infowmic cpu get namelscpuGet-WmiObject Win32_Processor
Memory infowmic memorychip get sizefree -hGet-WmiObject Win32_PhysicalMemory
Disk infowmic logicaldisk get size,freespacedf -hGet-WmiObject Win32_LogicalDisk
Process listtasklistps auxGet-Process
Service listsc querysystemctl list-unitsGet-Service

PowerShell System Information

# Computer information
Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion, TotalPhysicalMemory

# Disk space
Get-WmiObject -Class Win32_LogicalDisk | Select-Object DeviceID, Size, FreeSpace

# Running processes
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10

# System uptime
(Get-CimInstance Win32_OperatingSystem).LastBootUpTime

Remote Management

PowerShell Remoting

# Enable PS Remoting (run as administrator)
Enable-PSRemoting -Force

# Connect to remote computer
Enter-PSSession -ComputerName RemotePC

# Run command on remote computer
Invoke-Command -ComputerName RemotePC -ScriptBlock {Get-Process}

# Copy files to remote computer
Copy-Item -Path "local.txt" -Destination "\\RemotePC\C$\temp\" -ToSession $session

SSH on Windows

# Install OpenSSH Client (Windows 10/11)
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

# Connect via SSH
ssh username@hostname

# Copy files via SCP
scp file.txt username@hostname:/path/to/destination

Execution Policies and Security

PowerShell Execution Policies

PolicyDescriptionLinux Equivalent
RestrictedNo scripts allowedNo execute permission
RemoteSignedLocal scripts and signed remote scriptsMixed permissions
UnrestrictedAll scripts allowedExecute permission
# Check current policy
Get-ExecutionPolicy

# Set policy (as administrator)
Set-ExecutionPolicy RemoteSigned

# Bypass policy for single session
powershell -ExecutionPolicy Bypass -File script.ps1

Script Security

# Sign a script (requires code signing certificate)
Set-AuthenticodeSignature -FilePath script.ps1 -Certificate $cert

# Check script signature
Get-AuthenticodeSignature script.ps1

Terminal Customization

Windows Terminal Themes

{
"schemes": [
{
"name": "Linux-like",
"black": "#2e3436",
"red": "#cc0000",
"green": "#4e9a06",
"yellow": "#c4a000",
"blue": "#3465a4",
"purple": "#75507b",
"cyan": "#06989a",
"white": "#d3d7cf",
"brightBlack": "#555753",
"brightRed": "#ef2929",
"brightGreen": "#8ae234",
"brightYellow": "#fce94f",
"brightBlue": "#729fcf",
"brightPurple": "#ad7fa8",
"brightCyan": "#34e2e2",
"brightWhite": "#eeeeec",
"background": "#2e3436",
"foreground": "#d3d7cf"
}
]
}

PowerShell Profile Customization

# Check if profile exists
Test-Path $PROFILE

# Create profile
New-Item -ItemType File -Path $PROFILE -Force

# Edit profile
notepad $PROFILE

Example profile:

# PowerShell profile (~/.config/powershell/profile.ps1 equivalent)

# Set aliases
Set-Alias ll Get-ChildItem
Set-Alias la 'Get-ChildItem -Force'

# Custom prompt (like bash PS1)
function prompt {
$user = $env:USERNAME
$computer = $env:COMPUTERNAME
$path = $PWD.Path.Replace($HOME, "~")
"$user@$computer`:$path$ "
}

# Import modules
Import-Module posh-git # Git integration

Best Practices for Linux Users

Transition Tips

  1. Start with Windows Terminal: Modern terminal experience
  2. Use PowerShell: More powerful than Command Prompt
  3. Learn object pipeline: Different from text-based pipes
  4. Install package manager: Chocolatey or winget
  5. Set up SSH: For remote access
  6. Customize profile: Make it feel like home
  7. Use WSL when needed: For Linux tools and commands

Command Discovery

# Find commands
Get-Command *process*

# Get help
Get-Help Get-Process -Examples

# Find modules
Find-Module -Name "*git*"

# Discover object properties
Get-Process | Get-Member

Useful PowerShell Modules

ModulePurposeInstallation
posh-gitGit integrationInstall-Module posh-git
PSReadLineBetter command line editingBuilt-in (Windows 10+)
Terminal-IconsFile type iconsInstall-Module Terminal-Icons
zDirectory jumpingInstall-Module z

Performance Tips

  1. Use aliases: For frequently used commands
  2. Profile optimization: Don't load heavy modules unnecessarily
  3. Object filtering: Use Where-Object early in pipelines
  4. Background jobs: For long-running tasks
  5. ISE vs Terminal: Use appropriate tool for task