Introduction to PowerShell
PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework.
What is PowerShell?
While traditional shells like Bash are text-based (passing strings between commands), PowerShell is object-oriented. It is built on the .NET framework, meaning it passes structured objects instead of raw text.
🚀 Key Philosophy: Everything is an Object
In Bash, ls returns a string. To get a file size, you must use awk or cut to parse that string.
In PowerShell, Get-ChildItem (the equivalent of ls) returns a FileInfo Object.
# In PowerShell, you just access the property directly
(Get-ChildItem "report.txt").LengthCore Features
- Cmdlets: Built-in commands that follow a
Verb-Nounpattern. - Alias Support: Provides familiar aliases like
ls,cd, andcurlfor Bash/CMD users. - Cross-Platform: PowerShell Core runs on Windows, Linux, and macOS.
PowerShell Versions
| Version | Foundation | Platform | Status |
|---|---|---|---|
| Windows PowerShell (5.1) | .NET Framework | Windows Only | Legacy / Pre-installed |
| PowerShell Core (7.x) | .NET Core | Cross-Platform | Recommended for DevOps |
[!TIP] Check your version Run
$PSVersionTablein your terminal to see which version of PowerShell you are currently using.