Created
October 9, 2019 00:25
-
-
Save jgmel/93d58497c7e50739ed264febe252401e to your computer and use it in GitHub Desktop.
bash_aliases
This file contains 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
# Column N | |
c() { awk "{print \$$1}"; } | |
# find | |
alias f="find . -name " | |
# Editor | |
alias e="code" | |
alias e-="code -" | |
e.() { cat | sed -n "${1}p" | ( read file; e $file; ); } | |
# ps | |
alias ps="ps auxf" | |
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e" | |
# mkdir | |
alias mkdir="mkdir -p" | |
mkcd() { mkdir -p $1; cd $1; } | |
# cd | |
alias cd..="cd .." | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
alias -- -='less' | |
alias -- +='more' | |
# some more ls aliases | |
alias sl='ls' | |
alias lsa='ls -lsa' | |
alias cl='clear' | |
alias cls='clear' | |
alias lsl="ls -lhFA | less" | |
# inet | |
alias ipe='curl -s ipinfo.io/ip' | |
alias ipi='ip route get 8.8.8.8 | head -n1 | c 7' | |
alias whoiam='whois $( ipe )' | |
alias www='python -m SimpleHTTPServer 8000' | |
bgpas() { if [ -z $1 ]; then ip=$(ipe); else ip=$1; fi; whois -h whois.radb.net -- "-i origin ${ip}" | grep ^origin: | awk '{print $2}'; } | |
bgpip() { if [ -z $1 ]; then read as; else as=$1; fi; whois -h whois.radb.net -- "-i origin ${as}" | grep ^route: | awk '{print $2}'; } | |
## get top process eating memory | |
alias psmem='ps auxf | sort -nr -k 4' | |
alias psmem10='ps auxf | sort -nr -k 4 | head -10' | |
## get top process eating cpu ## | |
alias pscpu='ps auxf | sort -nr -k 3' | |
alias pscpu10='ps auxf | sort -nr -k 3 | head -10' | |
# Json tools (pipe unformatted to these to nicely format the JSON) | |
alias json="python -m json.tool" | |
alias jsonf="python -m json.tool" | |
# history | |
alias hs='history | grep' | |
# git | |
alias gac="git add . && git commit -a -m " | |
# Permissions | |
alias chx='chmod 755' | |
alias chr='chmod 644' | |
alias +x='chmod +x' | |
alias +w='chmod +w' | |
#other | |
alias active='grep -v -e "^$" -e"^ *#"' | |
# more | |
test -d ~/.bash_aliases.d/ && \ | |
for file in ~/.bash_aliases.d/* ; do | |
. $file; | |
done | |
alias X280="ssh -fXC 192.168.15.110 'x2x -east -to :0.0'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment