DEV Community

Discussion on: What are your CLI go to commands and aliases?

Collapse
 
kenbellows profile image
Ken Bellows • Edited

Some of my .bashrc aliases:

# easily grep through ps output
alias psgrep="ps aux | grep -v grep | grep"

# git shorthands
alias ga="git add"
alias gA="git add -A"
alias gc="git commit -m"
alias gca="git commit -am"
alias gs="git status"
alias gd="git diff"
alias glog='git log --pretty=format:"%C(yellow)%h %C(cyan)%<(24)%ad %Cgreen%an%C(auto)%d%Creset: %s" --date=local'
alias gl="glog -10"

# ls shorthands
alias ls="ls --color=auto"
alias l="ls"
alias ll="ls -l"
alias la="ls -a"
alias lA="ls -A"
alias lla="ls -la"
alias llA="ls -lA"

The git shorthands above are actually kind of a lie; I actually have a (probably unnecessarily) complicated couple of bash functions, supported by a python script that parses git status output and assigns a number to each changed file, to allow easier shorthands. gs shows git status with the numbers inline before each file, then ga and gd will accept those numbers as arguments, so I can do ga 3 to stage the 3rd modified file for commit or gd 3 to show the diff for that file. Maybe I'll write a post about those functions at some point so someone can show me how to improve them...