Skip to content

Instantly share code, notes, and snippets.

@moaalaa
Created January 8, 2026 15:56
Show Gist options
  • Select an option

  • Save moaalaa/2b942c684f023cb4cc92a5e3f05523eb to your computer and use it in GitHub Desktop.

Select an option

Save moaalaa/2b942c684f023cb4cc92a5e3f05523eb to your computer and use it in GitHub Desktop.
For powershell on windows

Powershell 7+

First we need Powershell V7 or above You can check your version with

$PSVersionTable.PSVersion

If following version or above appear you good to go

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      5      4

Else install powershell 7 from the microsoft Store or the github repo

Oh My Posh

you caninstall from microsoft store or the following command

winget install JanDeDobbeleer.OhMyPosh --source winget

Theme/fonts

  • Install a nerd fonts to get the best of the tools
  • Choose the theme you want from oh my posh website
  • Then open the powershell current user all hosts so the theme we will appy and configration applied for all hosts (like vscode built-in terminal)
notepad $profile.currentUserAllHosts

Add the Theme and the configration you want

# ==============================
# Prompt (oh-my-posh)
# ==============================
if (Get-Command oh-my-posh -ErrorAction SilentlyContinue) {
oh-my-posh init pwsh --config ~/oh-my-posh-themes/atomic.omp.custom.json | Invoke-Expression
# Alternative themes (disabled)
# oh-my-posh init pwsh --config ~/oh-my-posh-themes/atomic.omp.json | Invoke-Expression
# oh-my-posh init pwsh --config ~/oh-my-posh-themes/powerlevel10k_rainbow.omp.json | Invoke-Expression
# oh-my-posh init pwsh --config ~/oh-my-posh-themes/robbyrussell.omp.json | Invoke-Expression
# oh-my-posh init pwsh --config ~/oh-my-posh-themes/spaceship.omp.json | Invoke-Expression
}
# ==============================
# PSReadLine
# ==============================
Import-Module PSReadLine
# Tab completion menu
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
# History navigation with arrows
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
# Predictions & tooltips
Set-PSReadLineOption -ShowToolTips
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Set-PSReadLineOption -PredictionViewStyle ListView
# ==============================
# PHP / Laravel
# ==============================
function pint { & .\vendor\bin\pint }
function pest { & .\vendor\bin\pest }
function pestf { & .\vendor\bin\pest --filter $args }
function parapest { & .\vendor\bin\pest --parallel }
function paratest { & .\vendor\bin\paratest }
function pu { & .\vendor\bin\phpunit }
function puf { & .\vendor\bin\phpunit --filter $args }
function artisan { & php artisan $args }
function art { & php artisan $args }
function migrate { & php artisan migrate }
function fresh { & php artisan migrate:fresh }
function freshSeed { & php artisan migrate:fresh --seed }
function tinker { & php artisan tinker }
function serve { & php artisan serve }
# ==============================
# Composer
# ==============================
function com { & composer $args }
function comi { & composer install }
function comdump { & composer dump-autoload }
# ==============================
# Git
# ==============================
function g { git $args }
function gi { git init }
function ga { git add $args }
function gaa { git add . }
function gc { git commit -m ($args -join ' ') }
function gac { git add .; git commit -m ($args -join ' ') }
function wip { git add .; git commit -m 'WIP' }
function gs { git status }
function gl {
git log --graph `
--pretty=format:"%Cred%h%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" `
--abbrev-commit
}
function gcln { git clone $args }
function gpsh { git push $args }
function gpll { git pull $args }
function gcom { git checkout master }
# ==============================
# Go
# ==============================
function gor { go run $args }
function gorm { go run main.go $args }
function gora { go run *.go $args }
function gobld { go build $args }
function gobldm { go build main.go $args }
function goblda { go build *.go $args }
# ==============================
# Misc
# ==============================
function myWork { Set-Location 'E:\work' }
# ==============================
# Linux-like commands
# ==============================
# ===== LS / directory listing =====
function ls { Get-ChildItem -Force }
function ll { Get-ChildItem -Force | Format-Table Name, Length, LastWriteTime, Mode }
function la { Get-ChildItem -Force }
function lsa { Get-ChildItem -Force -Recurse | Format-Table Name, Length, LastWriteTime, Mode }
# ===== CAT / reading files =====
function cat { Get-Content $args }
# ===== LESS / paginated view =====
function less {
param([string]$file)
Get-Content $file | Out-Host -Paging
}
# ===== TOUCH / create empty file or update timestamp =====
function touch {
param([string]$file)
if (-Not (Test-Path $file)) {
New-Item $file -ItemType File | Out-Null
}
else {
(Get-Item $file).LastWriteTime = Get-Date
}
}
# ===== MKDIR / create directory =====
function mkdir {
param([string]$dir)
New-Item -ItemType Directory -Force -Path $dir | Out-Null
}
# ===== RM / remove files/directories =====
function rm {
param([string]$path)
Remove-Item -Force -Recurse -Path $path
}
# ===== CP / copy files/directories =====
function cp {
param([string]$source, [string]$destination)
Copy-Item -Path $source -Destination $destination -Recurse -Force
}
# ===== MV / move/rename files =====
function mv {
param([string]$source, [string]$destination)
Move-Item -Path $source -Destination $destination -Force
}
# ===== PWD / print working directory =====
function pwd { Get-Location }
# ===== CLEAR / clear screen =====
function clear { Clear-Host }
# ===== HEAD / first n lines of a file =====
function head {
param([string]$file, [int]$n = 10)
Get-Content $file | Select-Object -First $n
}
# ===== TAIL / last n lines of a file =====
function tail {
param([string]$file, [int]$n = 10)
Get-Content $file | Select-Object -Last $n
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment