Skip to content

Instantly share code, notes, and snippets.

@benjaminadk
Last active August 27, 2019 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminadk/55c85d4da429c3f0b97545deffc2ee65 to your computer and use it in GitHub Desktop.
Save benjaminadk/55c85d4da429c3f0b97545deffc2ee65 to your computer and use it in GitHub Desktop.
my bash aliases
alias bashreload="source ~/.bashrc && echo Bash config reloaded" # reload bashrc
alias histg="history | grep" # seach history $1
alias mkdir="mkdir -pv" # make parent dirs as needed
alias q="exit" # quit
alias c='clear' # clear screen
alias h="history | grep" # search command history
alias p="cat" # print file
alias ~='cd ~' # home dir
alias cd..='cd ..' # back one dir
alias ..='cd ..' # back one dir
alias ...='cd ../../' # back two dirs
alias ....='cd ../../../' # back three dirs
alias .....='cd ../../../../' # back four dirs
alias l='ls -CF' # list
alias ll='ls -alF' # list all files with detail
alias la='ls -A' # list all
alias 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 labc='ls -lap' #alphabetical sort
alias lf="ls -l | egrep -v '^d'" # files only
alias ldir="ls -l | egrep '^d'" # directories only
# alias chmod commands
alias mx='chmod a+x'
alias 000='chmod -R 000'
alias 644='chmod -R 644'
alias 666='chmod -R 666'
alias 755='chmod -R 755'
alias 777='chmod -R 777'
alias df="df -Tha --total" # disk usage
alias free="free -mt" # free memory
alias ps="ps auxf" # process list
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e" # process search follow with search term
alias json="python -m json.tool" # format json
alias env="printenv" # print environment vars
alias bashrc="vim ~/.bashrc" # open .bashrc
alias bashal="vim ~/.bash_aliases" # open .bash_alias
alias server="vim /etc/nginx/sites-available/default"
alias hook="/root/go/bin/webhook -hooks /root/hooks/hooks.json -ip "206.189.172.40" -verbose"
# print PATH
function path(){
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}
# create directory and cd into it
function mcd(){
mkdir $1
cd $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment