LINUX PowerShell
alias alias
alias cmd=’new alias’ Set-Alias ‘new alias’ cmd
cat a >> b cat a |sc b
clear cls
date Get-Date
df Get-PSDrive
echo “Hi”>>./file Add-content ./file “Hi”
env Get-Variable
grep -i findstr /i
grep <pattern> Select-String -Pattern <pattern>
hostname get-childitem -path env:computername
ip addr ipconfig
ls ls
ls -a ls -force
ls -ltr ls | sort-object LastWriteTime -Descending
ls -R ls -r
nc servername 1433 Test-NetConnection -ComputerName ‘servername’ -Port 1433
ps -ef Get-Process
tail -n 10 -f ./x.txt Get-Content ./x.txt -Wait -Tail 10
time measure-command
uptime (get-date) – (gcim Win32_OperatingSystem).LastBootUpTime |select Days,Hours,Minutes,Seconds
wget Invoke-WebRequest http://example.tar -OutFile example.tar
which Get-Command
who -T query user /server:$env:computername
| awk ‘{print $1}’ | %{ $_.Split(‘ ‘)[0]; }
Install an app (with sample arguments):
Start-Process -FilePath "C:\Temp\UpgradeClientInstaller\setup.exe" -ArgumentList "/S /v/qn"
Install using chocolatey:
choco install -y <packagename>
choco upgrade -y <packagename>