question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'man' should be removed as an alias on Windows installations

See original GitHub issue

Summary of the new feature / enhancement

The man alias on Windows is not needed and adds confusion when using PowerShell with multiple operating systems.

On Windows

PS> get-command man

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           man -> help

On Linux

PS> get-command man

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     man                                                0.0.0.0    /usr/bin/man

So depending on the system you are using they return completely different information.

On Linux

PS> man pwsh
PWSH(1)                                                                                                       PWSH(1)

NAME
       pwsh - PowerShell command-line shell and .NET REPL

SYNOPSIS
       pwsh  [-NoLogo]  [-NoExit]  [-NoProfile]  [-NonInteractive] [-InputFormat {Text | XML}] [-OutputFormat {Text |
       XML}] [-EncodedCommand Base64EncodedCommand] [-File filePath args] [-ExecutionPolicy  ExecutionPolicy]  [-Com‐
       mand { - | script-block [-args arg-array] | string [CommandParameters] } ]

DESCRIPTION
       PowerShell  is  an automation and configuration management platform. It consists of a cross-platform (Windows,
       Linux and macOS) command-line shell and associated scripting language.

But on Windows,

PS> man pwsh
Get-Help:
Line |
  64 |      $help = Get-Help @PSBoundParameters
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Get-Help could not find pwsh in a help file in this session. To download updated help topics type: "Update-Help". To get help online, search for the help topic in the TechNet library at https://go.microsoft.com/fwlink/?LinkID=107116.

man as a command has no historical lineage on Windows except for with Unix/shell emulators. help does, and even existed in MSDOS commmand.com.

Having man as an alias does not “make PowerShell like bash” because it returns completely different information.

Proposed technical implementation details (optional)

Remove the ‘man’ alias on windows installations.

Issue Analytics

  • State:closed
  • Created 4 months ago
  • Reactions:1
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
mklement0commented, May 13, 2023

Pragmatically speaking, you can put the following in your $PROFILE to also get Unix man behavior on Windows - assuming WSL is installed:

Remove-Alias man; function man { wsl -e man $args }

I was never a fan of aliases named for other platforms’ utilities / other shells’ built-in commands, but to me the only compelling reason to take an existing alias away is if it shadows a standard utility on a given platform - and even that can be problematic, especially if no PowerShell-native alternative exists (for an infamous case where that happened, see the sc / sc.exe fiasco; I advocated for removal at the time, which I regret in hindsight, given that Set-Content now has no built-in alias)

While I understand the cross-platform argument, it’s important to note that there are plenty of Windows-only users, and the potential confusion doesn’t apply to them; they may have come to value this alias (and @kborowinski seems to value it even as a cross-platform user).

Note that man is only one of quite a few aliases that are Windows-only:

# Run on Windows with WSL and a nested PowerShell version installed
$windowsAliases = pwsh -noprofile { (Get-Alias).Name }
$unixAliases = wsl -e bash -ic 'pwsh -noprofile -c ''(Get-Alias).Name'''
Compare-Object $windowsAliases $unixAliases

Output:

InputObject SideIndicator
----------- -------------
ac          <=
cat         <=
clear       <=
cnsn        <=
compare     <=
cp          <=
cpp         <=
diff        <=
dnsn        <=
gsv         <=
kill        <=
ls          <=
man         <=
mount       <=
mv          <=
ogv         <=
ps          <=
rm          <=
rmdir       <=
sasv        <=
shcm        <=
sleep       <=
sort        <=
spsv        <=
start       <=
tee         <=
write       <=
1reaction
rhubarb-geek-nzcommented, May 16, 2023

This discussion has been useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'man' should be removed as an alias on Windows ...
'man' should be removed as an alias on Windows installations #17342. Sign in to view logs · Sign in to view logs. Summary....
Read more >
Closing account to use email as alias?
First, any email addresses included in a post are removed for security reasons so no one can see what has been entered which...
Read more >
So is the alias feature locked behind a paid version now?
I've always been able to set aliases on my computers and today I did a fresh windows install and now the alias button...
Read more >
Python was not found; run without arguments to install from ...
Check your Python version and be sure it is installed on your machine ... Go to -> "start" and type "Manage App Execution...
Read more >
Removing the PowerShell curl alias? - Daniel Stenberg - Haxx
We added a number of aliases for Unix commands but if someone has installed those commands on WIndows, those aliases screw them up....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found