Powershell: Feature Request - whereis alias for Get-Command

Created on 7 Mar 2020  路  6Comments  路  Source: PowerShell/PowerShell

Summary of the new feature/enhancement

As a part-time Linux user, I am used to using whereis. I would like an alias forGet-Command to whereis in PowerShell. Currently, no whereis alias is available.

image

Proposed technical implementation details

Considering I use about 10 commands in Linux and most of them have already been aliased in PowerShell since the early days, I would like to create a PR to add this alias to PowerShell itself.

Oh, that's not very technical, but basically I'd read the source code for other Linux-based aliases, and modify for whereis to Get-Command and assume I must have agreement first.

Issue-Enhancement Resolution-Answered

Most helpful comment

IMHO it's so easy to ship and sync your user profile around that this should stay in the realm of a profile alias. You can also always ship a module that adds tons of aliases and completers, but I think keeping the surface area of the core of powershell small and lean on existing available extensibility is the right move here.

All 6 comments

While there's been quite a bit of opposition to adding some aliases that collide with Linux in the past... I think this makes a lot of sense.

Get-Command can and will find both native utilities as well as PowerShell commands, so despite overshadowing the builtin whereis alias, I think this would largely end up being an enhancement of it, rather than a detractor.

IMHO it's so easy to ship and sync your user profile around that this should stay in the realm of a profile alias. You can also always ship a module that adds tons of aliases and completers, but I think keeping the surface area of the core of powershell small and lean on existing available extensibility is the right move here.

There are many Powershell modules and short names (aliases) can conflict. Current intention is to delegate aliases to users - they can create aliases in their profiles as they prefer.

FWIW, here's what I personally have in my toolbox:

  • whatis.ps1
  • whence.ps1
  • dirname.ps1

Unix-isms for PowerShell.zip

This allows constructs such as:

  • code (whence foo)
  • code (dirname (whence bar))
  • ii (dirname (whence baz))

Very crude, but does the job.

(I used MKS Toolkit / Korn Shell as my standard shell / scripting environment on Windows, both at home and at work, for more than 25 years... @BrucePay will remember that was a great environment...)

Working at MKS was great. A very cool company.

A nice company to work with, too. I was a beta tester for quite some time. My personal and professional relationship with them started to degrade when product activation was introduced. Then someday they didn't want me as a tester anymore... So I had to bite the bullet and convert all my ksh workloads to... PowerShell ;-)

Was this page helpful?
0 / 5 - 0 ratings