2019-12-31
The secret index of all Stack Overflow blog posts
Note that, for the current year, the page numbers change as new blog posts are added to the Stack Overflow blog. So this is an appropriate day to publish it!
2019-12-08
Getting the ARM toolchain to work on Ubuntu 19.04 and later
See my blog post "Getting the ARM toolchain to work on Ubuntu 19.04 and later" (no, not this one).
This is an update to "Getting started with 1Bitsy and Black Magic Probe" (which only works up until Ubuntu 18.04 (Bionic Beaver)).
2019-10-04
PowerShell aliases and missing Microsoft documentation
Unfortunately, in most cases, Microsoft's documentation for a PowerShell cmdlet is lacking information about the aliases.
For instance, the documentation for Get-ChildItem fails to include information about the aliases ls, dir, and gci.
Resolution
Running cmdlet Get-Alias in a PowerShell session will list all aliases (for that version of PowerShell).
The interesting fields in the output from Get-Alias are:
"Name" The alias. E.g. "ls"
"Definition" The cmdlet. E.g. "Get-Content"
Get-Alias by itself will (roughly) output in alphabetic order of the aliases. Probably more interesting is grouping by cmdlets and then the aliases for that cmdlet in alphabetic order (sort with primary key on "Definition" and secondary key on "Name"):
Get-Alias | select Name, Definition, DisplayName | Sort-Object Definition, Name
Note that the alias "sort" for "Sort-Object" can not be used with later versions of PowerShell on Linux (yes, with PowerShell 6 released in 2016 it runs on Linux).
If the output is needed in some particular format, e.g., rows in an HTML table:
Get-Alias | select Name, Definition, DisplayName | sort Definition, Name | foreach { "<tr> <td>{0,1}</td> <td>{1,1}</td> </tr>" -f $_.Name, $_.Definition }
Interesting aliases
Some short aliases are:- % is an alias for ForEach-Object. ForEach-Object is also commonly known by another alias, foreach.
- ? is an alias for Where-Object. Where-Object is also commonly known by another alias, where
- h is an alias for Get-History. Another alias is ghy.
- ps (like on Unix) is an alias for Get-Process.
List of aliases
Alias | Cmdlet |
---|---|
asnp | Add-PSSnapIn |
clc | Clear-Content |
clhy | Clear-History |
clear | Clear-Host |
cls | Clear-Host |
cli | Clear-Item |
clp | Clear-ItemProperty |
clv | Clear-Variable |
compare | Compare-Object |
diff | Compare-Object |
cnsn | Connect-PSSession |
CFS | ConvertFrom-String |
cvpa | Convert-Path |
copy | Copy-Item |
cp | Copy-Item |
cpi | Copy-Item |
cpp | Copy-ItemProperty |
dbp | Disable-PSBreakpoint |
dnsn | Disconnect-PSSession |
ebp | Enable-PSBreakpoint |
etsn | Enter-PSSession |
exsn | Exit-PSSession |
epal | Export-Alias |
epcsv | Export-Csv |
epsn | Export-PSSession |
% | ForEach-Object |
foreach | ForEach-Object |
fc | Format-Custom |
fhx | Format-Hex |
fl | Format-List |
ft | Format-Table |
fw | Format-Wide |
gal | Get-Alias |
dir | Get-ChildItem |
gci | Get-ChildItem |
ls | Get-ChildItem |
gcb | Get-Clipboard |
gcm | Get-Command |
gin | Get-ComputerInfo |
cat | Get-Content |
gc | Get-Content |
type | Get-Content |
ghy | Get-History |
h | Get-History |
history | Get-History |
gi | Get-Item |
gp | Get-ItemProperty |
gpv | Get-ItemPropertyValue |
gjb | Get-Job |
gl | Get-Location |
pwd | Get-Location |
gm | Get-Member |
gmo | Get-Module |
gps | Get-Process |
ps | Get-Process |
gbp | Get-PSBreakpoint |
gcs | Get-PSCallStack |
gdr | Get-PSDrive |
gsn | Get-PSSession |
gsnp | Get-PSSnapIn |
gsv | Get-Service |
gtz | Get-TimeZone |
gu | Get-Unique |
gv | Get-Variable |
gwmi | Get-WmiObject |
group | Group-Object |
man | help |
ipal | Import-Alias |
ipcsv | Import-Csv |
ipmo | Import-Module |
ipsn | Import-PSSession |
icm | Invoke-Command |
iex | Invoke-Expression |
ihy | Invoke-History |
r | Invoke-History |
ii | Invoke-Item |
irm | Invoke-RestMethod |
curl | Invoke-WebRequest |
iwr | Invoke-WebRequest |
wget | Invoke-WebRequest |
iwmi | Invoke-WMIMethod |
measure | Measure-Object |
md | mkdir |
mi | Move-Item |
move | Move-Item |
mv | Move-Item |
mp | Move-ItemProperty |
nal | New-Alias |
ni | New-Item |
nmo | New-Module |
mount | New-PSDrive |
ndr | New-PSDrive |
nsn | New-PSSession |
npssc | New-PSSessionConfigurationFile |
nv | New-Variable |
ogv | Out-GridView |
oh | Out-Host |
lp | Out-Printer |
popd | Pop-Location |
ise | powershell_ise.exe |
pushd | Push-Location |
rcjb | Receive-Job |
rcsn | Receive-PSSession |
del | Remove-Item |
erase | Remove-Item |
rd | Remove-Item |
ri | Remove-Item |
rm | Remove-Item |
rmdir | Remove-Item |
rp | Remove-ItemProperty |
rjb | Remove-Job |
rmo | Remove-Module |
rbp | Remove-PSBreakpoint |
rdr | Remove-PSDrive |
rsn | Remove-PSSession |
rsnp | Remove-PSSnapin |
rv | Remove-Variable |
rwmi | Remove-WMIObject |
ren | Rename-Item |
rni | Rename-Item |
rnp | Rename-ItemProperty |
rvpa | Resolve-Path |
rujb | Resume-Job |
select | Select-Object |
sls | Select-String |
sal | Set-Alias |
scb | Set-Clipboard |
sc | Set-Content |
si | Set-Item |
sp | Set-ItemProperty |
cd | Set-Location |
chdir | Set-Location |
sl | Set-Location |
sbp | Set-PSBreakpoint |
stz | Set-TimeZone |
set | Set-Variable |
sv | Set-Variable |
swmi | Set-WMIInstance |
shcm | Show-Command |
sort | Sort-Object |
sajb | Start-Job |
saps | Start-Process |
start | Start-Process |
sasv | Start-Service |
sleep | Start-Sleep |
spjb | Stop-Job |
kill | Stop-Process |
spps | Stop-Process |
spsv | Stop-Service |
sujb | Suspend-Job |
tee | Tee-Object |
trcm | Trace-Command |
wjb | Wait-Job |
? | Where-Object |
where | Where-Object |
echo | Write-Output |
write | Write-Output |
Platform
This was tested on Windows 10 and PowerShell 5.1:
$PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 18362 145