Skip to content

Instantly share code, notes, and snippets.

@LordShedy
Last active January 19, 2020 19:24
Show Gist options
  • Save LordShedy/d31969618204aa68262e8cab7a8b2462 to your computer and use it in GitHub Desktop.
Save LordShedy/d31969618204aa68262e8cab7a8b2462 to your computer and use it in GitHub Desktop.
Bash aliases
# function to hide aliases that do not work on MacOS
function drwn(){
if [[ `uname` != "Darwin" ]]
then
alias "${1}"
fi
}
### CD ###
alias home='cd ~'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
### DIR ###
drwn dir='dir --color=always'
drwn vdir='vdir --color=always'
### RM ###
alias rmd='/bin/rm --recursive --force --verbose '
alias rm='rm -iv'
#### GREP ###
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias zgrep='zgrep --color=auto'
#### LS ###
alias alah='ls -alah'
alias la='ls -AFlh' # show hidden files
drwn lx='ls -lXBh' # sort by extension
alias lk='ls -lSrh' # sort by size
alias lc='ls -lcrh' # sort by change time
alias lu='ls -lurh' # sort by access time
alias lr='ls -lRh' # recursive ls
alias lt='ls -ltrh' # sort by date
alias lm='ls -alh | more' # pipe through 'more'
alias lw='ls -xAh' # wide listing format
alias ll='ls -Fl' # long listing format
alias labc='ls -lap' #alphabetical sort
alias lf="ls -l | egrep -v '^d'" # files only
alias ldir="ls -l | egrep '^d'" # directories only
#### SSH ###
alias ssh-add='ssh-add -t 20m'
alias ssh-fingerprint='ssh-keygen -E md5 -lf'
alias ssh-keygen-strong='ssh-keygen -t rsa -b 8192'
alias ssh-ecdsa-keyscan='ssh-keyscan -t ecdsa'
alias ssh-ecdsa-fingerprint='ssh -lf'
### GIT ###
alias gs='git status'
alias gb='git branch'
alias gf='git fetch'
alias ge='git ls-files --others --exclude-from=.git/info/exclude'
### PBCOPY ###
drwn pbcopy='xclip -selection clipboard'
drwn pbpaste='xclip -selection clipboard -o'
#### OTHER ####
alias tree='tree --dirsfirst -F'
alias less='less -R'
alias tailf='tail -f'
drwn lsblko='lsblk | grep -v loop'
alias h="history | grep "
alias e='exit'
#### EVALS ####
eval $(ssh-agent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment