Skip to content

Missing - "sort" alias for Sort-Object #827

Closed

Description

I use aliases like "sort" in Windows...in PowerShell for Linux do local exes in the path take precedence over aliases? Perhaps "sort" is missing.

There are 155 aliases in PowerShell for Windows and 113 on Ubuntu. That's a pretty big gap.

PS /home/scott/Desktop> Get-Process | Sort VM -desc | Select -first 5 | Format-Table
Sort : The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:15

  • Get-Process | Sort VM -desc | Select -first 5 | Format-Table
  •           ~~~~
    
    • CategoryInfo : ObjectNotFound: (Sort:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

image

Activity

  1. andyleejordan commented on Apr 13, 2016

    @andyleejordan
    Member

    Correct, this was a requested change. Please see #567 and #786; the former has a snippet to add the aliases back if you desire them. You can place that in your ~/powershell/profile.ps1.

  2. andyleejordan commented on Apr 13, 2016

    @andyleejordan
    Member

    I should say that they don't actually take precedence (in fact, the aliases will take precedence); but it was because of this behavior that we removed them.

  3. mahmoodn commented on May 12, 2021

    @mahmoodn

    Hi
    I have the same problem on Ubuntu 20.04 and Powershell 7.1. Is there any way to fix that? I see that the reporting date is for five years ago.

      15 |  …  | Select VM, IPAddress , @{N='Notes';E={$_.VM.Notes}} | Sort -Proper …
         |                                                             ~~~~
         | The term 'Sort' is not recognized as a name of a cmdlet, function, script file, or executable
         | program. Check the spelling of the name, or if a path was included, verify that the path is
         | correct and try again.
    
    

    Some information are shown below

    PS /home/mahmood> $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      7.1.3
    PSEdition                      Core
    GitCommitId                    7.1.3
    OS                             Linux 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021
    Platform                       Unix
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    WSManStackVersion              3.0
    PS /home/mahmood> Get-Module  -ListAvailable
    
        Directory: /home/mahmood/.local/share/powershell/Modules
    
    ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
    ---------- -------    ---------- ----                                --------- ----------------
    Binary     1.0.0                 Microsoft.PowerShell.SecretManagem… Core      {Register-SecretVault, Unregiste…
    Binary     1.0.0                 Microsoft.PowerShell.SecretStore    Core      {Unlock-SecretStore, Set-SecretS…
    Script     12.2.0.17…            VMware.CloudServices                Desk      {Connect-Vcs, Disconnect-Vcs, Ge…
    Script     7.0.2.178…            VMware.DeployAutomation             Desk      {Add-CustomCertificate, Add-Depl…
    Script     7.0.2.178…            VMware.ImageBuilder                 Desk      {Add-EsxSoftwareDepot, Add-EsxSo…
    Manifest   12.3.0.17…            VMware.PowerCLI                     Desk
    Script     7.0.2.178…            VMware.Vim                          Desk
    Script     12.3.0.17…            VMware.VimAutomation.Cis.Core       Desk      {Connect-CisServer, Disconnect-C…
    Script     12.0.0.15…            VMware.VimAutomation.Cloud          Desk      {Add-CIDatastore, Connect-CIServ…
    Script     12.3.0.17…            VMware.VimAutomation.Common         Desk      {Get-PowerCLIContext, Get-Task, …
    Script     12.3.0.17…            VMware.VimAutomation.Core           Desk      {Add-PassthroughDevice, Add-Virt…
    Script     12.3.0.17…            VMware.VimAutomation.Hcx            Desk      {Connect-HCXServer, Disconnect-H…
    Script     12.3.0.17…            VMware.VimAutomation.HorizonView    Desk      {Connect-HVServer, Disconnect-HV…
    Script     12.0.0.15…            VMware.VimAutomation.License        Desk      Get-LicenseDataManager
    Script     12.3.0.17…            VMware.VimAutomation.Nsxt           Desk      {Connect-NsxtServer, Disconnect-…
    Script     12.2.0.17…            VMware.VimAutomation.Sdk            Desk      {Get-ErrorReport, EnableParamete…
    Script     12.3.0.17…            VMware.VimAutomation.Security       Desk      {Add-AttestationServiceInfo, Add…
    Script     12.3.0.17…            VMware.VimAutomation.Srm            Desk      {Connect-SrmServer, Disconnect-S…
    Script     12.3.0.17…            VMware.VimAutomation.Storage        Desk      {Add-EntityDefaultKeyProvider, A…
    Script     1.6.0.0               VMware.VimAutomation.StorageUtility Desk      Update-VmfsDatastore
    Script     12.3.0.17…            VMware.VimAutomation.Vds            Desk      {Add-VDSwitchPhysicalNetworkAdap…
    Script     12.2.0.17…            VMware.VimAutomation.Vmc            Desk      {Add-VmcSddcHost, Connect-Vmc, D…
    Script     12.2.0.17…            VMware.VimAutomation.vROps          Desk      {Connect-OMServer, Disconnect-OM…
    Script     12.3.0.17…            VMware.VimAutomation.WorkloadManag… Desk      {Disable-WMCluster, Enable-WMClu…
    Script     12.1.0.16…            VMware.VumAutomation                Desk      {Add-EntityBaseline, Copy-Patch,…
    
        Directory: /opt/microsoft/powershell/7/Modules
    
    ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
    ---------- -------    ---------- ----                                --------- ----------------
    Manifest   1.2.5                 Microsoft.PowerShell.Archive        Desk      {Compress-Archive, Expand-Archiv…
    Manifest   7.0.0.0               Microsoft.PowerShell.Host           Core      {Start-Transcript, Stop-Transcri…
    Manifest   7.0.0.0               Microsoft.PowerShell.Management     Core      {Add-Content, Clear-Content, Cle…
    Manifest   7.0.0.0               Microsoft.PowerShell.Security       Core      {Get-Credential, Get-ExecutionPo…
    Manifest   7.0.0.0               Microsoft.PowerShell.Utility        Core      {Export-Alias, Get-Alias, Import…
    Script     1.4.7                 PackageManagement                   Desk      {Find-Package, Get-Package, Get-…
    Script     2.2.5                 PowerShellGet                       Desk      {Find-Command, Find-DSCResource,…
    Script     2.0.5                 PSDesiredStateConfiguration         Core      {Configuration, New-DscChecksum,…
    Script     2.1.0                 PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-P…
    Binary     2.0.3                 ThreadJob                           Desk      Start-ThreadJob
    
    
  4. mahmoodn commented on May 12, 2021

    @mahmoodn

    OK I followed the topics and the solution is to use Sort-Object instead of Sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions