Skip to content

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

GitHub - marticliment/UniGetUI: UniGetUI: The Graphical Interface for your package managers. Could be terribly described as a package manager manager to manage your package managers

winget install --exact --id MartiCliment.UniGetUI --source winget

Tips

kill The Process by PID

taskkill /PID <PID> /F

Find out the Process Occupied the port

the last line of output is PID

netstat -ano | findstr :<port>

Find out the Process Occupied the file

Sysinternals Suite - Microsoft Apps

handle.exe <file path>

Get Command .exe Path

where.exe poetry

->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

Add-Content -Path $PROFILE -Value "`n`$env:PATH += `";C:\Program Files\Git\bin`""

SUDO

winget install gerardog.gsudo

settings->?(sudo)->Enable sudo inline