43 lines
1.5 KiB
Markdown
43 lines
1.5 KiB
Markdown
# PowerShell Cheat-Sheet
|
|
PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language.
|
|
|
|
## Install PowerShell
|
|
PowerShell was made open-source and cross-platform with PowerShell Core, and can be installed on multiple operating systems.
|
|
|
|
### Windows
|
|
1. Download MSI Package from the [Official PowerShell Docs](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2)
|
|
2. Set up PowerShell Profile in [Windows Terminal](windows/windows-terminal.md).
|
|
```json
|
|
"commandline": "pwsh.exe -nologo",
|
|
"name": "Powershell",
|
|
"source": "Windows.Terminal.PowershellCore"
|
|
```
|
|
|
|
### Linux (Ubuntu)
|
|
```sh
|
|
# Update the list of packages
|
|
sudo apt-get update
|
|
# Install pre-requisite packages.
|
|
sudo apt-get install -y wget apt-transport-https software-properties-common
|
|
# Download the Microsoft repository GPG keys
|
|
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
|
|
# Register the Microsoft repository GPG keys
|
|
sudo dpkg -i packages-microsoft-prod.deb
|
|
# Update the list of packages after we added packages.microsoft.com
|
|
sudo apt-get update
|
|
# Install PowerShell
|
|
sudo apt-get install -y powershell
|
|
# Start PowerShell
|
|
pwsh
|
|
```
|
|
|
|
## Profile
|
|
Set up a PowerShell Profile by opening the profile script :
|
|
```powershell
|
|
code $PROFILE
|
|
```
|
|
|
|
## (Optional) Set up starship Prompt
|
|
You can customize the look and feel of PowerShell with the Starship Prompt ([[starship]]).
|
|
|