Skip to content

Commit 0480795

Browse files
authored
Refreshed article as of pwsh 7.4.2 on linux and macos (#11102)
Co-authored-by: Mike F. Robbins <[email protected]>
1 parent d02206b commit 0480795

File tree

1 file changed

+102
-84
lines changed

1 file changed

+102
-84
lines changed

reference/docs-conceptual/whats-new/unix-support.md

Lines changed: 102 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
11
---
22
description: This article summarizes the differences between PowerShell on Windows and PowerShell on non-Windows platforms.
3-
ms.date: 11/01/2022
3+
ms.date: 05/13/2024
44
title: PowerShell differences on non-Windows platforms
55
---
66
# PowerShell differences on non-Windows platforms
77

8-
PowerShell strives to provide feature parity across all supported platforms. But, due to differences
9-
in .NET Core and platform-specific differences, some features behave differently or aren't
10-
available. Additional changes have been made to improve interoperability of PowerShell on
11-
non-Windows platforms.
8+
PowerShell strives to provide feature parity across all supported platforms. However, some features
9+
behave differently or aren't available due to differences in .NET Core and platform-specific
10+
differences. Other changes were made to improve the interoperability of PowerShell on non-Windows
11+
platforms.
1212

1313
## .NET Framework vs .NET Core
1414

15-
PowerShell on Linux and macOS uses .NET Core, which is a subset of the full .NET Framework on
16-
Microsoft Windows. As a result, scripts that run on Windows may not run on non-Windows platforms
17-
because of the differences in the frameworks.
15+
PowerShell on Linux and macOS uses .NET Core, a subset of the full .NET Framework on Microsoft
16+
Windows. As a result, scripts that run on Windows might not run on non-Windows platforms because of
17+
the differences in the frameworks.
1818

1919
For more information about changes in .NET Core, see
2020
[Breaking changes for migration from .NET Framework to .NET Core][01].
2121

2222
## General Unix interoperability changes
2323

24-
- Added support for native command globbing on Unix platforms. This means you can
25-
use wildcards with native commands like `ls *.txt`.
24+
- Added support for native command globbing on Unix platforms. This means you can use wildcards with
25+
native commands like `ls *.txt`.
2626
- The `more` functionality respects the Linux `$PAGER` and defaults to `less`.
2727
- Trailing backslash is automatically escaped when dealing with native command arguments.
2828
- Fixed ConsoleHost to honor `NoEcho` on Unix platforms.
29-
- don't add `PATHEXT` environment variable on Unix
30-
- A `powershell` man-page is included in the package
29+
- Don't add `PATHEXT` environment variable on Unix.
30+
- A `powershell` man-page is included in the package.
3131

3232
## Execution policy
3333

34-
The `-ExecutionPolicy` parameter is ignored when running PowerShell on non-Windows platforms.
35-
`Get-ExecutionPolicy` returns **Unrestricted** on Linux and macOS. `Set-ExecutionPolicy` does
36-
nothing on Linux and macOS.
34+
PowerShell ignores execution policies when running on non-Windows platforms. `Get-ExecutionPolicy`
35+
returns **Unrestricted** on Linux and macOS. `Set-ExecutionPolicy` does nothing on Linux and macOS.
3736

3837
## Case-sensitivity in PowerShell
3938

4039
Historically, PowerShell has been uniformly case-insensitive, with few exceptions. On UNIX-like
41-
operating systems, the file system is predominantly case-sensitive and PowerShell adheres to the
40+
operating systems, the file system is predominantly case-sensitive, and PowerShell adheres to the
4241
standard of the file system.
4342

44-
- When specifying a file in PowerShell, the correct case must be used.
43+
- You must use the correct case when a filename in specified in PowerShell.
4544
- If a script tries to load a module and the module name isn't cased correctly, then the module load
46-
fails. This may cause a problem with existing scripts if the name by which the module is
47-
referenced doesn't match the proper case of the actual filename.
45+
fails. This behavior might cause a problem with existing scripts if the name referenced by the
46+
module doesn't match the proper case of the actual filename.
4847
- While names in the filesystem are case-sensitive, tab-completion of filenames isn't
4948
case-sensitive. Tab-completion cycles through the list of names using case-insensitive matching.
5049
- `Get-Help` supports case-insensitive pattern matching on Unix platforms.
51-
- `Import-Module` is case insensitive when it's using a filename to determine the module's name.
50+
- `Import-Module` is case insensitive when used with a filename to determine the module name.
5251

5352
## Filesystem support for Linux and macOS
5453

55-
- Paths given to cmdlets are now slash-agnostic (both / and \ work as directory separator)
54+
- Paths given to cmdlets are now slash-agnostic (both `/` and `\` work as directory separators)
5655
- XDG Base Directory Specification is now respected and used by default:
5756
- The Linux/macOS profile path is located at `~/.config/powershell/profile.ps1`
5857
- The history save path is located at `~/.local/share/powershell/PSReadline/ConsoleHost_history.txt`
5958
- The user module path is located at `~/.local/share/powershell/Modules`
6059
- Support for file and folder names containing the colon character on Unix.
6160
- Support for script names or full paths that have commas.
62-
- Detect when `-LiteralPath` is used to suppress wildcard expansion for navigation cmdlets.
61+
- Detect when the **LiteralPath** parameter is used to suppress wildcard expansion for navigation
62+
cmdlets.
6363
- Updated `Get-ChildItem` to work more like the *nix `ls -R` and the Windows `DIR /S` native
6464
commands. `Get-ChildItem` now returns the symbolic links encountered during a recursive search and
6565
doesn't search the directories that those links target.
@@ -68,16 +68,16 @@ standard of the file system.
6868

6969
PowerShell scripts must end in `.ps1` for the interpreter to understand how to load and run them in
7070
the current process. Running scripts in the current process is the expected usual behavior for
71-
PowerShell. The `#!` magic number may be added to a script that doesn't have a `.ps1` extension, but
72-
this causes the script to be run in a new PowerShell instance preventing the script from working
73-
properly when interchanging objects. This may be the desirable behavior when executing a PowerShell
74-
script from `bash` or another shell.
71+
PowerShell. You can add the `#!` magic number to a script that doesn't have a `.ps1` extension, but
72+
this causes the script to be run in a new PowerShell instance, preventing the script from working
73+
correctly when interchanging objects. This behavior might be desirable when executing a PowerShell
74+
script from Bash or another shell.
7575

7676
## Convenience aliases removed
7777

78-
On Windows, PowerShell provides a set of aliases that map to Linux command names for user
78+
PowerShell provides a set of aliases on Windows that map to Linux command names for user
7979
convenience. On Linux and macOS, the "convenience aliases" for the basic commands `ls`, `cp`, `mv`,
80-
`rm`, `cat`, `man`, `mount`, `ps` have been removed to allow the native executable to run without
80+
`rm`, `cat`, `man`, `mount`, and `ps` were removed to allow the native executable to run without
8181
specifying a path.
8282

8383
## Logging
@@ -87,43 +87,55 @@ On Linux, PowerShell uses [Syslog][09], a ubiquitous logging solution.
8787

8888
## Job Control
8989

90-
There is no Unix-style job-control support in PowerShell on Linux or macOS. The `fg` and `bg`
91-
commands aren't available. You can use [PowerShell jobs][02] that do work across all platforms.
90+
There's no Unix-style job-control support in PowerShell on Linux or macOS. The `fg` and `bg`
91+
commands aren't available. However, you can use [PowerShell jobs][02] that work on all platforms.
9292

9393
Putting `&` at the end of a pipeline causes the pipeline to be run as a PowerShell job. When a
9494
pipeline is backgrounded, a job object is returned. Once the pipeline is running as a job, all
9595
`*-Job` cmdlets can be used to manage the job. Variables (ignoring process-specific variables) used
9696
in the pipeline are automatically copied to the job so `Copy-Item $foo $bar &` just works. The job
97-
is also run in the current directory instead of the user's home directory.
97+
runs in the current directory instead of the user's home directory.
9898

9999
## Remoting Support
100100

101101
PowerShell Remoting (PSRP) using WinRM on Unix platforms requires NTLM/Negotiate or Basic Auth over
102102
HTTPS. PSRP on macOS only supports Basic Auth over HTTPS. Kerberos-based authentication isn't
103103
supported.
104104

105-
PowerShell supports PowerShell Remoting (PSRP) over SSH on all platforms (Windows, macOS, and
106-
Linux). For more information, see [SSH remoting in PowerShell][04].
105+
PowerShell supports PowerShell Remoting (PSRP) over SSH on all platforms (Windows, Linux, and
106+
macOS). For more information, see [SSH remoting in PowerShell][04].
107107

108108
## Just-Enough-Administration (JEA) Support
109109

110-
The ability to create constrained administration (JEA) remoting endpoints isn't available in
111-
PowerShell on Linux or macOS.
110+
PowerShell on Linux or macOS doesn't allow you to create constrained administration (JEA) remoting
111+
endpoints.
112112

113113
## `sudo`, `exec`, and PowerShell
114114

115-
Because PowerShell runs most commands in memory (like Python or Ruby), you can't use sudo directly
116-
with PowerShell built-ins. You can run `pwsh` from sudo. If it's necessary to run a PowerShell
117-
cmdlet from within PowerShell with sudo, for example, `sudo Set-Date 8/18/2016`, then you would do
118-
`sudo pwsh Set-Date 8/18/2016`.
115+
Because PowerShell runs most commands in memory (like Python or Ruby), you can't use `sudo` directly
116+
with PowerShell built-ins. You can run `pwsh` from `sudo`. If it's necessary to run a PowerShell
117+
cmdlet from within PowerShell with `sudo`, for example, `sudo Set-Date 8/18/2016`, then you would
118+
use `sudo pwsh Set-Date 8/18/2016`.
119119

120-
## Missing Cmdlets
120+
## Modules included on non-Windows platforms
121121

122-
A large number of the commands (cmdlets) normally available in PowerShell aren't available on Linux
123-
or macOS. In many cases, these commands make no sense on these platforms (e.g. Windows-specific
124-
features like the registry). Other commands like the service control commands are present, but not
125-
functional. Future releases may correct these problems by fixing the broken cmdlets and adding new
126-
ones over time.
122+
For non-Windows platforms, PowerShell includes the following modules:
123+
124+
- Microsoft.PowerShell.Archive
125+
- Microsoft.PowerShell.Core
126+
- Microsoft.PowerShell.Host
127+
- Microsoft.PowerShell.Management
128+
- Microsoft.PowerShell.Security
129+
- Microsoft.PowerShell.Utility
130+
- PackageManagement
131+
- PowerShellGet
132+
- PSReadLine
133+
- ThreadJob
134+
135+
A large number of the commands (cmdlets) commonly available in PowerShell aren't available on Linux
136+
or macOS. Often, these commands don't apply to these platforms. For example, commands for
137+
Windows-specific features like the registry or services aren't available. Other commands, like
138+
`Set-ExecutionPolicy`, are present but not functional.
127139

128140
For a comprehensive list of modules and cmdlets and the platforms they support, see
129141
[Release history of modules and cmdlets][05].
@@ -149,27 +161,31 @@ The following Windows-specific modules aren't included in PowerShell for Linux o
149161

150162
## Cmdlets not available on non-Windows platforms
151163

152-
For non-Windows platforms, PowerShell includes the following modules:
153-
154-
- Microsoft.PowerShell.Archive
155-
- Microsoft.PowerShell.Core
156-
- Microsoft.PowerShell.Host
157-
- Microsoft.PowerShell.Management
158-
- Microsoft.PowerShell.Security
159-
- Microsoft.PowerShell.Utility
160-
- PackageManagement
161-
- PowerShellGet
162-
- PSDesiredStateConfiguration
163-
- PSReadLine
164-
- ThreadJob
165-
166-
However, some cmdlets have been removed from PowerShell, and others aren't available or may work
167-
differently on non-Windows platforms. For a comprehensive list of cmdlets removed from PowerShell,
168-
see [Cmdlets removed from PowerShell][06].
164+
Some cmdlets were removed from PowerShell. Others aren't available or might work differently on
165+
non-Windows platforms. For a comprehensive list of cmdlets removed from PowerShell, see
166+
[Cmdlets removed from PowerShell][06].
169167

170168
### Microsoft.PowerShell.Core
171169

172-
The **ShowWindow** parameter of `Get-Help` isn't available for non-Windows platforms.
170+
The following cmdlets aren't available on Linux or macOS:
171+
172+
- `Disable-PSRemoting`
173+
- `Enable-PSRemoting`
174+
- `Connect-PSSession`
175+
- `Disconnect-PSSession`
176+
- `Receive-PSSession`
177+
- `Get-PSSessionCapability`
178+
- `Disable-PSSessionConfiguration`
179+
- `Enable-PSSessionConfiguration`
180+
- `Get-PSSessionConfiguration`
181+
- `Register-PSSessionConfiguration`
182+
- `Set-PSSessionConfiguration`
183+
- `Unregister-PSSessionConfiguration`
184+
- `Test-PSSessionConfigurationFile`
185+
186+
The **ShowWindow** parameter of `Get-Help` isn't available for non-Windows platforms. PowerShell 7.3
187+
added the `Switch-Process` cmdlet and the `exec` function for Linux and macOS. These commands aren't
188+
available on Windows.
173189

174190
### Microsoft.PowerShell.Security cmdlets
175191

@@ -192,8 +208,20 @@ These cmdlets are only available beginning in PowerShell 7.1.
192208

193209
The following cmdlets aren't available on Linux and macOS:
194210

195-
- `Clear-RecycleBin`
211+
- `Rename-Computer`
212+
- `Get-ComputerInfo`
196213
- `Get-HotFix`
214+
- `Clear-RecycleBin`
215+
- `Get-Service`
216+
- `New-Service`
217+
- `Remove-Service`
218+
- `Restart-Service`
219+
- `Resume-Service`
220+
- `Set-Service`
221+
- `Start-Service`
222+
- `Stop-Service`
223+
- `Suspend-Service`
224+
- `Set-TimeZone`
197225

198226
The following cmdlets are available with limitations:
199227

@@ -208,59 +236,49 @@ The following cmdlets aren't available on Linux and macOS:
208236

209237
- `Convert-String`
210238
- `ConvertFrom-String`
239+
- `ConvertFrom-SddlString`
211240
- `Out-GridView`
212241
- `Out-Printer`
213242
- `Show-Command`
214243

215244
## Aliases not available on Linux or macOS
216245

217246
The following table lists the aliases available for Windows that aren't available on non-Windows
218-
platforms. These aliases aren't available because the target cmdlet isn't available or the alias
219-
conflicts with a native command on those platforms.
247+
platforms. These aliases aren't available because the alias conflicts with a native command on those
248+
platforms.
220249

221250
| Alias | Cmdlet |
222251
| --------- | ---------------------- |
223252
| `ac` | `Add-Content` |
224253
| `cat` | `Get-Content` |
225254
| `clear` | `Clear-Host` |
226-
| `cnsn` | `Connect-PSSession` |
227255
| `compare` | `Compare-Object` |
228256
| `cp` | `Copy-Item` |
229257
| `cpp` | `Copy-ItemProperty` |
230258
| `diff` | `Compare-Object` |
231-
| `dnsn` | `Disconnect-PSSession` |
232-
| `gsv` | `Get-Service` |
233259
| `kill` | `Stop-Process` |
234260
| `ls` | `Get-ChildItem` |
235261
| `man` | `help` |
236262
| `mount` | `New-PSDrive` |
237263
| `mv` | `Move-Item` |
238-
| `ogv` | `Out-GridView` |
239264
| `ps` | `Get-Process` |
240265
| `rm` | `Remove-Item` |
241266
| `rmdir` | `Remove-Item` |
242-
| `sasv` | `Start-Service` |
243-
| `shcm` | `Show-Command` |
244267
| `sleep` | `Start-Sleep` |
245268
| `sort` | `Sort-Object` |
246-
| `spsv` | `Stop-Service` |
247269
| `start` | `Start-Process` |
248270
| `tee` | `Tee-Object` |
249271
| `write` | `Write-Output` |
250272

251-
## PowerShell Desired State Configuration (DSC)
252-
253-
Many cmdlets were removed from the PSDesiredStateConfiguration module beginning in PowerShell 6.0.
254-
Support for DSC on non-Windows platforms is limited and mostly experimental. The
255-
`Invoke-DscResource` cmdlet was restored as an experimental feature in PowerShell 7.0.
273+
The table doesn't include aliases unavailable for cmdlets that don't exist on non-Windows platforms.
256274

257-
DSC isn't supported on macOS.
258-
259-
For more information about using DSC on Linux, see [Get started with DSC for Linux][03].
275+
## PowerShell Desired State Configuration (DSC)
260276

261-
Beginning with PowerShell 7.2, the **PSDesiredStateConfiguration** module has been removed from
262-
PowerShell and is published to the PowerShell Gallery. For more information, see the
263-
[announcement][07] in the PowerShell Team blog.
277+
Beginning with PowerShell 7.2, the **PSDesiredStateConfiguration** module was removed from
278+
PowerShell and is published in the PowerShell Gallery. For more information, see the
279+
[announcement][07] on the PowerShell Team blog. For more information about using DSC on Linux, see
280+
[Get started with DSC for Linux][03]. DSC v1.1 and v2.x aren't supported on macOS. DSC v3 is
281+
supported on Windows, Linux, and macOS, but it's still in early development.
264282

265283
<!-- link references -->
266284
[01]: /dotnet/core/compatibility/fx-core

0 commit comments

Comments
 (0)