LinuxCommandLibrary

pwsh

Cross-platform PowerShell shell

TLDR

Start PowerShell

$ pwsh
copy
Execute command
$ pwsh -Command "[Get-Process]"
copy
Run script
$ pwsh -File [script.ps1]
copy
Non-interactive mode
$ pwsh -NonInteractive -Command "[command]"
copy
Specific version
$ pwsh -Version
copy

SYNOPSIS

pwsh [options] [file]

DESCRIPTION

pwsh is the executable for PowerShell, Microsoft's cross-platform shell and scripting language that runs on Linux, macOS, and Windows. It provides an object-oriented pipeline where commands output structured .NET objects rather than plain text, enabling rich data manipulation without parsing.
PowerShell includes a comprehensive set of cmdlets for system administration, file management, and process control. Scripts use the .ps1 extension and support advanced features like modules, remoting, and error handling. The -Command flag executes inline commands while -File runs script files, and -NonInteractive mode is useful for automation and CI/CD pipelines.

PARAMETERS

FILE

Script file to execute.
-Command CMD
Execute command.
-File FILE
Execute script file.
-NonInteractive
No interactive prompt.
-NoProfile
Don't load profile.
-Version
Show version.

CONFIGURATION

~/.config/powershell/profile.ps1

User profile script executed on startup, used to define aliases, functions, and environment customizations.
~/.config/powershell/Microsoft.PowerShell_profile.ps1
Host-specific profile loaded only in the default PowerShell host.
$PROFILE
Built-in variable pointing to the current user's profile path for the active host.

CAVEATS

Requires installation. Different from Windows PowerShell.

HISTORY

PowerShell Core was released by Microsoft as cross-platform shell.

SEE ALSO

bash(1), zsh(1), sh(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community