Yesterday’s post, “Using Aliases To Improve Command Line Experience”, looked at how to use aliases to improve your terminal workflow. In particular we looked at the z-shell and bash shell, both available in Linux, Unix and macOS.

In this post we will look at how to do the same in Windows with PowerShell.

To my pleasant surprise, eza is available in Window

You can install it as follows:

winget install eza-community.eza

Winget will download, install the software.

You can also use chocolatey instead.

You can check that it works by running the software.

eza

You should see something like this:

ezaWindows

PowerShell supports aliases, using the set-alias cmdlet.

Similar to the approach on Unix, Windows and macOS, we start by opening our profile:

nvim $profile

Neovim, mercifully, is also available on Windows, but you can use the editor of your choice.

Next we configure eza.

# Delete the existing alias
Remove-Item Alias:\ls

# Define a function for ls
function ls {
    eza --long --icons=auto
}

powershellExa

A couple of things to note:

  1. ls in PowerShell is already an alias for Get-ChildItem. We first need to remove this alias using the Remove-Item cmdlet
  2. Much as PowerShell supports aliases, you cannot create an alias for a command with parameter. You have to crate a function instead.

Save and then reload the profile.

. $profile

Now we can verify if everything worked.

ls

ezaWindowsList

TLDR

Eza can also be configured in windows to replace the built in ls command.

Happy hacking!