Tuesday, November 3, 2015

bash_profile for Mac

# reloads the prompt, usefull to take new modifications into account
alias reload="source ~/.bash_profile"

alias ll='ls -al'
alias ..="cd ../"
alias ...="cd ../../"
alias .3="cd ../../../"
alias .4="cd ../../../../"

#Find CPU hogs
alias cpu_hogs='ps wwaxr -o pid,stat,%cpu,time,command | head -10'

#recommended 'top' invocation to minimize resources
alias ttop="top -R -F -s 10 -o rsize"

# qfind: Quickly search for file alias qfind="find . -name "
alias qfind="find . -name "

# your public ip
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"

# your local ip
alias localip="ifconfig | sed -En 's/;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'"

#   ---------------------------
#   ---------------------------

# netCons:      Show all open TCP/IP sockets
alias netCons='lsof -i'

# flushDNS:     Flush out the DNS Cache
alias flushDNS='dscacheutil -flushcache'

# lsock:        Display open sockets
alias lsock='sudo /usr/sbin/lsof -i -P'

# lsockU:       Display only open UDP sockets
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP'

# lsockT:       Display only open TCP sockets
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP'

# ipInfo0:      Get info on connections for en0
alias ipInfo0='ipconfig getpacket en0'

# ipInfo1:      Get info on connections for en1
alias ipInfo1='ipconfig getpacket en1'

# openPorts:    All listening connections
alias openPorts='sudo lsof -i | grep LISTEN'

# showBlocked:  All ipfw rules inc/ blocked IPs
alias showBlocked='sudo ipfw list'

#   ii:  display useful host related informaton
#   -------------------------------------------------------------------
    ii() {
        echo -e "\nYou are logged on ${RED}$HOST"
        echo -e "\nAdditionnal information:$NC " ; uname -a
        echo -e "\n${RED}Users logged on:$NC " ; w -h
        echo -e "\n${RED}Current date :$NC " ; date
        echo -e "\n${RED}Machine stats :$NC " ; uptime
        echo -e "\n${RED}Current network location :$NC " ; scselect
        echo -e "\n${RED}Public facing IP Address :$NC " ;myip
        #echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns


No comments:

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX