0
0
PowerShellscripting~10 mins

PowerShell on Linux - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - PowerShell on Linux
Open Linux Terminal
Type 'pwsh' to start PowerShell
PowerShell prompt appears
Run PowerShell commands
Exit PowerShell with 'exit'
Back to Linux Terminal
This flow shows how to start PowerShell on Linux, run commands, and exit back to the Linux shell.
Execution Sample
PowerShell
pwsh
Get-Process | Select-Object -First 3
exit
Starts PowerShell on Linux, lists first 3 running processes, then exits PowerShell.
Execution Table
StepActionCommand EnteredOutputNext State
1Start PowerShellpwshPowerShell prompt appears: PS /home/user>PowerShell ready
2List processesGet-Process | Select-Object -First 3Shows 3 process objects with Id, Name, CPUPowerShell ready
3Exit PowerShellexitReturns to Linux terminal promptLinux shell ready
💡 Exited PowerShell, returned to Linux shell prompt
Variable Tracker
VariableStartAfter Step 2After Step 3
PowerShell SessionNot startedRunningClosed
Key Moments - 3 Insights
Why do I type 'pwsh' instead of 'powershell' on Linux?
On Linux, the PowerShell executable is called 'pwsh'. Step 1 in the execution_table shows starting PowerShell with 'pwsh'.
Can I run normal Linux commands inside PowerShell?
Yes, PowerShell on Linux can run Linux commands. But in the example, Step 2 shows a PowerShell command 'Get-Process'. Linux commands can be run too.
How do I exit PowerShell and return to Linux shell?
Typing 'exit' in PowerShell (Step 3) closes the session and returns you to the Linux terminal prompt.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what command starts PowerShell on Linux?
Apwsh
Bpowershell
CGet-Process
Dexit
💡 Hint
See Step 1 in execution_table where 'pwsh' starts PowerShell.
At which step does the PowerShell session end and return to Linux shell?
AStep 1
BStep 3
CStep 2
DPowerShell never ends
💡 Hint
Step 3 shows the 'exit' command returning to Linux shell.
If you run a Linux command inside PowerShell, where would you see the output?
ANo output is shown
BIn a separate Linux terminal window
CIn the PowerShell prompt output (like Step 2)
DOnly after exiting PowerShell
💡 Hint
PowerShell on Linux shows command output inside its prompt as in Step 2.
Concept Snapshot
PowerShell on Linux:
- Start with 'pwsh' command in Linux terminal
- PowerShell prompt appears (PS ...>)
- Run PowerShell or Linux commands inside
- Exit PowerShell with 'exit' to return to Linux shell
- Works like PowerShell on Windows but uses 'pwsh' executable
Full Transcript
To use PowerShell on Linux, open your Linux terminal and type 'pwsh' to start PowerShell. You will see the PowerShell prompt where you can run PowerShell commands like 'Get-Process'. You can also run Linux commands here. When done, type 'exit' to leave PowerShell and return to your Linux shell prompt. This process lets you use PowerShell scripting and automation on Linux systems easily.