Command aliases will be well known by many Bash users, the practise of setting aliases for common commands is frequently discussed and aliases are shared.
Just as the name suggests it is an alternate method of calling a command with its parameters using shortened or more meaningful text for example
alias sha='shasum -a 256'. In this example we can now call the shasum command with its arguments to create a sha256 checksum just by using the command
We can do the same with PowerShell and it comes with some already built in. Some common ones allow the use of well know commands inside the command shell so we don’t have to learn new ones, common examples are
dir which are aliases for the PowerShell cmdlet
If you want to see what Aliases you have set you can look at them all open PowerShell and type this
It will return a long list, this is just part of mine, you can see the output for dir highlighted in orange
if you only want to see what cmdlet an alias is for you can specify it on the command line
If you want to set your own, you can use set-alias, why don’t you use the help commands you learned about in the previous article to see if you can set your own alias.
PowerShell come with some cmdlets that are just available as soon as you start the command shell. Good examples of these are
Get-Help. PowerShell though can be use dot manage all sorts of Microsoft technologies including Exchange, Office 365 Azure et al. If every command was pre-installed the system would be enormous and incredibly slow and cumbersome, so like many other languages PowerShell stores collections of command together and you can import only the ones you need just when you need them.
PowerShell calls these collection Modules. You have to install them and then import them.
To see what you have available (Installed) and what you have imported use the cdmlets
In PowerShell 5.1 Modules will auto import when you attempt to use a cmdlet they contain. They must already be installed and I am not clear in which version of PowerShell this behaviour wa first seen.
We will look more at Modules, including making our own, in a future article.
Everything in PowerShell is treated like a filesystem. We will revisit this concept later, but all parts of the OS such as the registry are available as drives, if you want to view environment variable values the simplest way is to cd the the
You can now see all the environment variables by calling