Powershell¶
Oh My Posh¶
winget install JanDeDobbeleer.OhMyPosh -s winget
$env:Path += ";C:\Users\user\AppData\Local\Programs\oh-my-posh\bin"
oh-my-posh font install
code $PROFILE
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\peru.omp.json" | Invoke-Expression
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Import-Module Terminal-Icons
Set-PSReadLineKeyHandler -Chord Tab -Function MenuComplete
set powershell as default instead of windows powershell
set front in config-> default -> appearance
Tips¶
kill The Process by PID¶
Find out the Process Occupied the port¶
the last line of output is PID
Find out the Process Occupied the file¶
Sysinternals Suite - Microsoft Apps
Get Command .exe Path¶
->C:\Users\18317\AppData\Roaming\Python\Scripts\poetry.exe
Add Path¶
[!INFO] Especially for invoking commands through program itself instead of
pwsh
# admin
# use Tab to autocomlete to make sure path exit
$newPath = "C:\Program Files\xpdf-tools-win-4.05\bin64"
$currentPath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
if ($currentPath -notlike "*$newPath*") {
$updatedPath = $currentPath + ";" + $newPath
[Environment]::SetEnvironmentVariable("Path", $updatedPath, [System.EnvironmentVariableTarget]::Machine)
Write-Output "Path added successfully."
} else {
Write-Output "Path already exists in the system PATH."
}
# check path
[Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine) -split ";"
Using bash to Handle Shell¶
SUDO¶
settings->?(sudo)->Enable sudo inline