Last active
January 1, 2026 21:10
-
-
Save ernestohs/e3fc2d8c936f173128cca159391ca324 to your computer and use it in GitHub Desktop.
how lazy I am
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # BASH/ZSH ALIASES FOR THE LAZY DEVELOPER | |
| ## Git Workflow Aliases | |
| ### Push current branch to origin | |
| alias push='git push origin $(git rev-parse --abbrev-ref HEAD)' | |
| ### Pull current branch with submodules | |
| alias pull='git pull --recurse-submodules origin $(git rev-parse --abbrev-ref HEAD)' | |
| ### Show git status in short format | |
| alias s="git status -s" | |
| ### Commit with message (usage: c "commit message") | |
| alias c="git commit -m " | |
| ### Add all files and show status | |
| alias a='git add . && git status -s' | |
| ### Show git log in compact graph format | |
| alias l='git log --oneline --all --graph --decorate' | |
| ### Fetch and checkout branch (usage: gb branch-name) | |
| alias gb='git fetch && git checkout ' | |
| ### Revert changes to files (usage: undo file.txt) | |
| alias undo='git checkout --' | |
| ### Hard reset to previous commit | |
| alias reset='git reset --hard HEAD~1' | |
| ### Show what files would be cleaned (dry run) | |
| alias clean='git clean -dnx' | |
| ### Create and checkout new branch | |
| alias branch='git checkout -b' | |
| ### End-of-week commit workflow | |
| alias friday='pull && git checkout -b "friday-$(date +%Y-%m-%d)" && git commit -a -m "[WIP] Latest changes from Friday $(date +%Y-%m-%d)" && push' | |
| ### Show diff for specific files | |
| alias changes='git diff --' | |
| ### Abort current merge | |
| alias nomerge='git merge --abort' | |
| ## Docker Compose Aliases (Updated to use new 'docker compose' syntax) | |
| alias dc='sudo docker compose' # Docker compose with sudo | |
| alias dcu='sudo docker compose up' # Start services | |
| alias dcb='sudo docker compose up --build -d' # Build and start services in detached mode | |
| alias dcd='sudo docker compose down' # Stop and remove containers | |
| alias dcc='sudo docker compose down -v --remove-orphans' # Stop containers, remove volumes and orphans | |
| # NPM Aliases | |
| alias nr='npm run' # Run npm script (usage: nr script-name) | |
| alias nrs='npm run start' # Start development server | |
| alias nrb='npm run build' # Build project | |
| alias npi='npm install' # Install dependencies | |
| # Docker Aliases | |
| alias dp='sudo docker ps' # List running containers | |
| # System Aliases | |
| alias ls='ls -lah --color=auto' # Enhanced ls with human-readable sizes and colors | |
| # Aliases candidates | |
| ### Amend last commit | |
| alias amend='git commit --amend' | |
| ### Create fixup commit | |
| alias fixup='git commit --fixup' | |
| ### Interactive squash (usage: squash 3) | |
| alias squash='git rebase -i HEAD~' | |
| # Advanced Docker Aliases | |
| # List images | |
| alias di='sudo docker images' | |
| # Remove image | |
| alias drmi='sudo docker rmi' | |
| # List all containers (including stopped) | |
| alias dps='sudo docker ps -a' | |
| # Show container logs (usage: dlog container-name) | |
| alias dlog='sudo docker logs' | |
| # Follow container logs | |
| alias dlogf='sudo docker logs -f' | |
| # Execute command in container | |
| alias dexec='sudo docker exec -it' | |
| # Shell into container (usage: dsh container-name /bin/bash) | |
| alias dsh='sudo docker exec -it' | |
| # Stop container | |
| alias dstop='sudo docker stop' | |
| # Start container | |
| alias dstart='sudo docker start' | |
| # Remove container | |
| alias drm='sudo docker rm' | |
| # Remove unused containers, networks, images | |
| alias dprune='sudo docker system prune -f' | |
| # Remove everything unused (including volumes) | |
| alias dprunea='sudo docker system prune -af' | |
| # Docker Compose Extensions | |
| # Show service logs | |
| alias dcl='sudo docker compose logs' | |
| # Follow service logs | |
| alias dclf='sudo docker compose logs -f' | |
| # Execute command in service | |
| alias dce='sudo docker compose exec' | |
| # Restart services | |
| alias dcr='sudo docker compose restart' | |
| # Pull latest images | |
| alias dcp='sudo docker compose pull' | |
| # Show service status | |
| alias dcps='sudo docker compose ps' | |
| # NPM Extensions | |
| # Run tests | |
| alias nrt='npm run test' | |
| # Run tests in watch mode | |
| alias nrtw='npm run test:watch' | |
| # Run development server | |
| alias nrd='npm run dev' | |
| # Run linter | |
| alias nrl='npm run lint' | |
| # Run formatter | |
| alias nrf='npm run format' | |
| # Clean install from package-lock | |
| alias npci='npm ci' | |
| # Update packages | |
| alias npu='npm update' | |
| # Check for outdated packages | |
| alias npo='npm outdated' | |
| # Security audit | |
| alias npa='npm audit' | |
| # Fix security issues | |
| alias npaf='npm audit fix' | |
| # System and Navigation Aliases | |
| # Go up one directory | |
| alias ..='cd ..' | |
| # Go up two directories | |
| alias ...='cd ../..' | |
| # Go up three directories | |
| alias ....='cd ../../..' | |
| # Go to home directory | |
| alias ~='cd ~' | |
| # List all files in long format | |
| alias la='ls -la' | |
| # List in long format | |
| alias ll='ls -l' | |
| # List by time (newest last) | |
| alias lt='ls -lart' | |
| # List by size | |
| alias lsize='ls -laSh' | |
| # Create directories with parents and verbose | |
| alias mkdir='mkdir -pv' | |
| # Colorized grep | |
| alias grep='grep --color=auto' | |
| # Colorized fgrep | |
| alias fgrep='fgrep --color=auto' | |
| # Colorized egrep | |
| alias egrep='egrep --color=auto' | |
| # Command history | |
| alias h='history' | |
| # List active jobs | |
| alias j='jobs -l' | |
| # Print PATH in readable format | |
| alias path='echo -e ${PATH//:/\\n}' | |
| # Current time | |
| alias now='date +"%T"' | |
| # Current date | |
| alias today='date +"%d-%m-%Y"' | |
| # File Operations | |
| # Interactive and verbose copy | |
| alias cp='cp -iv' | |
| # Interactive and verbose move | |
| alias mv='mv -iv' | |
| # Interactive and verbose remove | |
| alias rm='rm -iv' | |
| # Interactive and verbose link | |
| alias ln='ln -iv' | |
| # Prevent chmod on root | |
| alias chmod='chmod --preserve-root' | |
| # Prevent chown on root | |
| alias chown='chown --preserve-root' | |
| # Network and System Info | |
| # Show open ports | |
| alias ports='netstat -tulanp' | |
| # Disk usage in human format | |
| alias diskusage='df -h' | |
| # Memory info in human format | |
| alias meminfo='free -h' | |
| # CPU information | |
| alias cpuinfo='lscpu' | |
| # Process Management | |
| # Process search (usage: psg process-name) | |
| alias psg='ps aux | grep -v grep | grep -i -e VSZ -e' | |
| # Top CPU processes | |
| alias topcpu='ps auxf | sort -nr -k 3 | head -10' | |
| # Top memory processes | |
| alias topmem='ps auxf | sort -nr -k 4 | head -10' | |
| # Quick Edits (adjust based on your preferred editor) | |
| # Edit and reload bashrc | |
| alias bashrc='nano ~/.bashrc && source ~/.bashrc' | |
| # Edit and reload zshrc | |
| alias zshrc='nano ~/.zshrc && source ~/.zshrc' | |
| # Edit hosts file | |
| alias hosts='sudo nano /etc/hosts' | |
| # Development Shortcuts | |
| # Quick HTTP server | |
| alias serve='python3 -m http.server' | |
| # Pretty print JSON | |
| alias jsonpp='python3 -m json.tool' | |
| # URL encode | |
| alias urlencode='python3 -c "import sys, urllib.parse as ul; print(ul.quote_plus(sys.argv[1]))"' | |
| # URL decode | |
| alias urldecode='python3 -c "import sys, urllib.parse as ul; print(ul.unquote_plus(sys.argv[1]))"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # POWERSHELL PROFILE - Aliases for the Lazy Developer | |
| # Ported from alias.sh with PowerShell equivalents | |
| #region Git Workflow Aliases | |
| function Get-GitPush { & git push origin (git rev-parse --abbrev-ref HEAD) $args } | |
| New-Alias -Name push -Value Get-GitPush -Force -Option AllScope | |
| function Get-GitPull { & git pull --recurse-submodules origin (git rev-parse --abbrev-ref HEAD) $args } | |
| New-Alias -Name pull -Value Get-GitPull -Force -Option AllScope | |
| function Get-GitStatus { & git status -sb $args } | |
| New-Alias -Name s -Value Get-GitStatus -Force -Option AllScope | |
| function Get-GitCommit { & git commit -m $args } | |
| New-Alias -Name c -Value Get-GitCommit -Force -Option AllScope | |
| function Get-GitAdd { | |
| if (!$args) { | |
| git add . | |
| } else { | |
| git add $args | |
| } | |
| git status -sb | |
| } | |
| New-Alias -Name a -Value Get-GitAdd -Force -Option AllScope | |
| function Get-GitTree { & git log --graph --oneline --decorate --all $args } | |
| New-Alias -Name l -Value Get-GitTree -Force -Option AllScope | |
| function Get-GitSwitchBranch { git fetch; git checkout $args } | |
| New-Alias -Name gb -Value Get-GitSwitchBranch -Force -Option AllScope | |
| function Get-GitUndo { & git checkout -- $args } | |
| New-Alias -Name undo -Value Get-GitUndo -Force -Option AllScope | |
| function Get-GitReset { & git reset --hard HEAD~1 $args } | |
| New-Alias -Name reset -Value Get-GitReset -Force -Option AllScope | |
| function Get-GitClean { & git clean -dnx $args } | |
| New-Alias -Name clean -Value Get-GitClean -Force -Option AllScope | |
| function Get-GitBranch { & git checkout -b $args } | |
| New-Alias -Name branch -Value Get-GitBranch -Force -Option AllScope | |
| function Get-GitFriday { | |
| $date = Get-Date -Format "yyyy-MM-dd" | |
| Get-GitPull | |
| git checkout -b "friday-$date" | |
| git commit -a -m "[WIP] Latest changes from Friday $date" | |
| Get-GitPush | |
| } | |
| New-Alias -Name friday -Value Get-GitFriday -Force -Option AllScope | |
| function Get-GitChanges { & git diff -- $args } | |
| New-Alias -Name changes -Value Get-GitChanges -Force -Option AllScope | |
| function Get-GitNoMerge { & git merge --abort } | |
| New-Alias -Name nomerge -Value Get-GitNoMerge -Force -Option AllScope | |
| function Get-GitAmend { & git commit --amend $args } | |
| New-Alias -Name amend -Value Get-GitAmend -Force -Option AllScope | |
| function Get-GitFixup { & git commit --fixup $args } | |
| New-Alias -Name fixup -Value Get-GitFixup -Force -Option AllScope | |
| function Get-GitSquash { & git rebase -i HEAD~$args } | |
| New-Alias -Name squash -Value Get-GitSquash -Force -Option AllScope | |
| #endregion | |
| #region Docker Compose Aliases | |
| function Invoke-DockerCompose { & docker compose $args } | |
| New-Alias -Name dc -Value Invoke-DockerCompose -Force -Option AllScope | |
| function Invoke-DockerComposeUp { & docker compose up $args } | |
| New-Alias -Name dcu -Value Invoke-DockerComposeUp -Force -Option AllScope | |
| function Invoke-DockerComposeBuild { & docker compose up --build -d $args } | |
| New-Alias -Name dcb -Value Invoke-DockerComposeBuild -Force -Option AllScope | |
| function Invoke-DockerComposeDown { & docker compose down $args } | |
| New-Alias -Name dcd -Value Invoke-DockerComposeDown -Force -Option AllScope | |
| function Invoke-DockerComposeClean { & docker compose down -v --remove-orphans $args } | |
| New-Alias -Name dcc -Value Invoke-DockerComposeClean -Force -Option AllScope | |
| function Invoke-DockerComposeLogs { & docker compose logs $args } | |
| New-Alias -Name dcl -Value Invoke-DockerComposeLogs -Force -Option AllScope | |
| function Invoke-DockerComposeLogsFollow { & docker compose logs -f $args } | |
| New-Alias -Name dclf -Value Invoke-DockerComposeLogsFollow -Force -Option AllScope | |
| function Invoke-DockerComposeExec { & docker compose exec $args } | |
| New-Alias -Name dce -Value Invoke-DockerComposeExec -Force -Option AllScope | |
| function Invoke-DockerComposeRestart { & docker compose restart $args } | |
| New-Alias -Name dcr -Value Invoke-DockerComposeRestart -Force -Option AllScope | |
| function Invoke-DockerComposePull { & docker compose pull $args } | |
| New-Alias -Name dcp -Value Invoke-DockerComposePull -Force -Option AllScope | |
| function Invoke-DockerComposePs { & docker compose ps $args } | |
| New-Alias -Name dcps -Value Invoke-DockerComposePs -Force -Option AllScope | |
| #endregion | |
| #region Docker Aliases | |
| function Get-DockerPs { & docker ps $args } | |
| New-Alias -Name dp -Value Get-DockerPs -Force -Option AllScope | |
| function Get-DockerImages { & docker images $args } | |
| New-Alias -Name di -Value Get-DockerImages -Force -Option AllScope | |
| function Remove-DockerImage { & docker rmi $args } | |
| New-Alias -Name drmi -Value Remove-DockerImage -Force -Option AllScope | |
| function Get-DockerPsAll { & docker ps -a $args } | |
| New-Alias -Name dps -Value Get-DockerPsAll -Force -Option AllScope | |
| function Get-DockerLogs { & docker logs $args } | |
| New-Alias -Name dlog -Value Get-DockerLogs -Force -Option AllScope | |
| function Get-DockerLogsFollow { & docker logs -f $args } | |
| New-Alias -Name dlogf -Value Get-DockerLogsFollow -Force -Option AllScope | |
| function Invoke-DockerExec { & docker exec -it $args } | |
| New-Alias -Name dexec -Value Invoke-DockerExec -Force -Option AllScope | |
| function Invoke-DockerShell { & docker exec -it $args } | |
| New-Alias -Name dsh -Value Invoke-DockerShell -Force -Option AllScope | |
| function Stop-DockerContainer { & docker stop $args } | |
| New-Alias -Name dstop -Value Stop-DockerContainer -Force -Option AllScope | |
| function Start-DockerContainer { & docker start $args } | |
| New-Alias -Name dstart -Value Start-DockerContainer -Force -Option AllScope | |
| function Remove-DockerContainer { & docker rm $args } | |
| New-Alias -Name drm -Value Remove-DockerContainer -Force -Option AllScope | |
| function Invoke-DockerPrune { & docker system prune -f $args } | |
| New-Alias -Name dprune -Value Invoke-DockerPrune -Force -Option AllScope | |
| function Invoke-DockerPruneAll { & docker system prune -af $args } | |
| New-Alias -Name dprunea -Value Invoke-DockerPruneAll -Force -Option AllScope | |
| #endregion | |
| #region NPM Aliases | |
| function Invoke-NpmRun { & npm run $args } | |
| New-Alias -Name nr -Value Invoke-NpmRun -Force -Option AllScope | |
| function Invoke-NpmStart { & npm run start } | |
| New-Alias -Name nrs -Value Invoke-NpmStart -Force -Option AllScope | |
| function Invoke-NpmBuild { & npm run build } | |
| New-Alias -Name nrb -Value Invoke-NpmBuild -Force -Option AllScope | |
| function Invoke-NpmInstall { & npm install $args } | |
| New-Alias -Name npi -Value Invoke-NpmInstall -Force -Option AllScope | |
| function Invoke-NpmTest { & npm run test $args } | |
| New-Alias -Name nrt -Value Invoke-NpmTest -Force -Option AllScope | |
| function Invoke-NpmTestWatch { & npm run test:watch $args } | |
| New-Alias -Name nrtw -Value Invoke-NpmTestWatch -Force -Option AllScope | |
| function Invoke-NpmDev { & npm run dev } | |
| New-Alias -Name nrd -Value Invoke-NpmDev -Force -Option AllScope | |
| function Invoke-NpmLint { & npm run lint $args } | |
| New-Alias -Name nrl -Value Invoke-NpmLint -Force -Option AllScope | |
| function Invoke-NpmFormat { & npm run format $args } | |
| New-Alias -Name nrf -Value Invoke-NpmFormat -Force -Option AllScope | |
| function Invoke-NpmCi { & npm ci } | |
| New-Alias -Name npci -Value Invoke-NpmCi -Force -Option AllScope | |
| function Invoke-NpmUpdate { & npm update $args } | |
| New-Alias -Name npu -Value Invoke-NpmUpdate -Force -Option AllScope | |
| function Invoke-NpmOutdated { & npm outdated } | |
| New-Alias -Name npo -Value Invoke-NpmOutdated -Force -Option AllScope | |
| function Invoke-NpmAudit { & npm audit } | |
| New-Alias -Name npa -Value Invoke-NpmAudit -Force -Option AllScope | |
| function Invoke-NpmAuditFix { & npm audit fix $args } | |
| New-Alias -Name npaf -Value Invoke-NpmAuditFix -Force -Option AllScope | |
| #endregion | |
| #region Navigation Aliases | |
| function Set-LocationUp1 { Set-Location .. } | |
| New-Alias -Name '..' -Value Set-LocationUp1 -Force -Option AllScope | |
| function Set-LocationUp2 { Set-Location ../.. } | |
| New-Alias -Name '...' -Value Set-LocationUp2 -Force -Option AllScope | |
| function Set-LocationUp3 { Set-Location ../../.. } | |
| New-Alias -Name '....' -Value Set-LocationUp3 -Force -Option AllScope | |
| function Set-LocationHome { Set-Location ~ } | |
| New-Alias -Name '~' -Value Set-LocationHome -Force -Option AllScope | |
| function Get-ChildItemAll { Get-ChildItem -Force $args } | |
| New-Alias -Name la -Value Get-ChildItemAll -Force -Option AllScope | |
| function Get-ChildItemLong { Get-ChildItem $args | Format-Table Mode, LastWriteTime, Length, Name } | |
| New-Alias -Name ll -Value Get-ChildItemLong -Force -Option AllScope | |
| function Get-ChildItemByTime { Get-ChildItem -Force $args | Sort-Object LastWriteTime } | |
| New-Alias -Name lt -Value Get-ChildItemByTime -Force -Option AllScope | |
| function Get-ChildItemBySize { Get-ChildItem -Force $args | Sort-Object Length -Descending } | |
| New-Alias -Name lsize -Value Get-ChildItemBySize -Force -Option AllScope | |
| #endregion | |
| #region System Info Aliases | |
| function Get-HistoryAlias { Get-History } | |
| New-Alias -Name h -Value Get-HistoryAlias -Force -Option AllScope | |
| function Get-JobsAlias { Get-Job } | |
| New-Alias -Name j -Value Get-JobsAlias -Force -Option AllScope | |
| function Get-PathReadable { $env:Path -split ';' | ForEach-Object { $_ } } | |
| New-Alias -Name path -Value Get-PathReadable -Force -Option AllScope | |
| function Get-TimeNow { Get-Date -Format "HH:mm:ss" } | |
| New-Alias -Name now -Value Get-TimeNow -Force -Option AllScope | |
| function Get-DateToday { Get-Date -Format "dd-MM-yyyy" } | |
| New-Alias -Name today -Value Get-DateToday -Force -Option AllScope | |
| function Get-OpenPorts { Get-NetTCPConnection | Where-Object State -eq 'Listen' | Sort-Object LocalPort } | |
| New-Alias -Name ports -Value Get-OpenPorts -Force -Option AllScope | |
| function Get-DiskUsage { Get-PSDrive -PSProvider FileSystem | Select-Object Name, @{N='Used(GB)';E={[math]::Round($_.Used/1GB,2)}}, @{N='Free(GB)';E={[math]::Round($_.Free/1GB,2)}}, @{N='Total(GB)';E={[math]::Round(($_.Used+$_.Free)/1GB,2)}} } | |
| New-Alias -Name diskusage -Value Get-DiskUsage -Force -Option AllScope | |
| function Get-MemInfo { | |
| $os = Get-CimInstance Win32_OperatingSystem | |
| [PSCustomObject]@{ | |
| 'Total(GB)' = [math]::Round($os.TotalVisibleMemorySize/1MB, 2) | |
| 'Free(GB)' = [math]::Round($os.FreePhysicalMemory/1MB, 2) | |
| 'Used(GB)' = [math]::Round(($os.TotalVisibleMemorySize - $os.FreePhysicalMemory)/1MB, 2) | |
| } | |
| } | |
| New-Alias -Name meminfo -Value Get-MemInfo -Force -Option AllScope | |
| function Get-CpuInfo { Get-CimInstance Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed } | |
| New-Alias -Name cpuinfo -Value Get-CpuInfo -Force -Option AllScope | |
| #endregion | |
| #region Process Management Aliases | |
| function Find-Process { Get-Process | Where-Object { $_.ProcessName -match $args } } | |
| New-Alias -Name psg -Value Find-Process -Force -Option AllScope | |
| function Get-TopCpu { Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, CPU, Id } | |
| New-Alias -Name topcpu -Value Get-TopCpu -Force -Option AllScope | |
| function Get-TopMem { Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 10 Name, @{N='Mem(MB)';E={[math]::Round($_.WorkingSet64/1MB,2)}}, Id } | |
| New-Alias -Name topmem -Value Get-TopMem -Force -Option AllScope | |
| #endregion | |
| #region Development Shortcuts | |
| function Start-HttpServer { | |
| param([int]$Port = 8000) | |
| & python -m http.server $Port | |
| } | |
| New-Alias -Name serve -Value Start-HttpServer -Force -Option AllScope | |
| function Format-JsonPretty { | |
| param([Parameter(ValueFromPipeline)]$InputObject) | |
| if ($InputObject) { | |
| $InputObject | ConvertFrom-Json | ConvertTo-Json -Depth 100 | |
| } | |
| } | |
| New-Alias -Name jsonpp -Value Format-JsonPretty -Force -Option AllScope | |
| function Get-UrlEncode { | |
| param([string]$Text) | |
| [System.Web.HttpUtility]::UrlEncode($Text) | |
| } | |
| New-Alias -Name urlencode -Value Get-UrlEncode -Force -Option AllScope | |
| function Get-UrlDecode { | |
| param([string]$Text) | |
| [System.Web.HttpUtility]::UrlDecode($Text) | |
| } | |
| New-Alias -Name urldecode -Value Get-UrlDecode -Force -Option AllScope | |
| #endregion | |
| #region Quick Edits | |
| function Edit-Profile { | |
| & notepad $PROFILE | |
| Write-Host "Run '. `$PROFILE' to reload after saving." -ForegroundColor Yellow | |
| } | |
| New-Alias -Name editprofile -Value Edit-Profile -Force -Option AllScope | |
| function Edit-Hosts { & notepad C:\Windows\System32\drivers\etc\hosts } | |
| New-Alias -Name hosts -Value Edit-Hosts -Force -Option AllScope | |
| #endregion | |
| # Load System.Web assembly for URL encoding/decoding | |
| Add-Type -AssemblyName System.Web -ErrorAction SilentlyContinue |
Author
Thanks @mauricioarellano, I already remove the duplicated line
Excellent, friday my favorite haha.
Author
Add a Powershell version, is still green but works
Author
Too lazy to update the latest version for Powershell, but it's now complete 😬
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 4 and 5 are duplicated :)