I thought I’d share some of the Powershell functions and aliases I’ve found useful over the years. I’ll try to keep this post updated as I find new ones.
Powershell Aliases
Most of the aliases below are pretty self-explanatory. They are just shortcuts to common commands.
|
|
Powershell Functions
This is where you can let go off your imagination and create some really cool functions. I’ll share some of the ones I’ve found useful.
Command History
I like having access to terminal history even after I close the terminal and reopen it later. So I wrote a function to do that. It uses PSReadLine plugin to query the history file and return the last 100 lines. I have this function aliased to hist
.
|
|
Open GitHub Repo in a Browser
I use this function to open the current directory in a browser directly from the command line. I have this aliased to gh
.
|
|
Find Executable Path
I use this function to find the path of an executable. It is nifty for finding the location of things like terraform or bicep. I have this aliased to which
.
|
|
Create A New Directory And Change To It
I use this function to create a new directory and change to it with one short alias. I have this aliased to mcd
.
|
|
Get OS Build Number
I am an active Windows Insider user, so I check my Windows build numbers frequently. I use this function to get the OS build number. I have this aliased to Get-OSBuild
.
|
|
Lazy Git Commit
I use this function to quickly commit changes to a git repo. I have this aliased to acp
. ACP stands for Add, Commit, Push.
|
|