Skip to content

Instantly share code, notes, and snippets.

@seperman seperman/Mac_bashrc
Last active Apr 21, 2017

What would you like to do?
mac bash profile
alias ll="ls -lah";
alias chrome="open /Applications/Google\";
alias firefox="open -a";
alias ssh_box="source ~/useful_shell_scripts/"
alias kcachegrind="open /Applications/";
alias fix_office_borders="~/useful_shell_scripts/";
alias tree="find . -not -name '*.pyc' -not -name '*.pyo' -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'";
alias dsize="du -ch -d 1 2>/dev/null";
alias dsize2="du -ch | tail -n 10";
export CLICOLOR=1;
export LSCOLORS=exfxcxdxbxegedabagacad;
export PATH=/usr/local/share/python:$PATH
source ~/useful_shell_scripts/
#Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
current_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
export PS1="\[\033[01;36m\]\u\[\033[01;31m\]@\[\033[01;36m\]\h\[\033[01;33m\]:\[\033[01;31m\]\w\[\033[01;33m\]\[\033[32m\]\$(parse_git_branch)\[\033[00m\]\$ "
if test -f "/usr/local/bin/"; then source "/usr/local/bin/";fi
function list_links () {
for thing in `find . -type l 2>/dev/null`; do
echo $thing "-->" `readlink $thing`
function findit () {
find . -iname "*$1*" 2>/dev/null
function mark2htm () {
filename=$(basename "$1")
pandoc "$fullpath" -o "$output".html --standalone -c ../markdown/GitHub2.css --toc --variable=pagetitle:"$filename" -t html5
function gitreset () {
git fetch origin
git reset --hard origin/$(parse_git_branch)
function gitfile(){
git log --follow -p -- "$1"
function gitpull () {
git pull origin $(parse_git_branch)
function gitpush () {
git push origin $(parse_git_branch) --recurse-submodules=check
function gits(){
git status
function gitc(){
git commit -av
function gita(){
git add -A
function ports(){
cat << EOF
-------- lsof --------
- All connections
lsof -i
- All tcp connections
lsof -iTCP
- All processes listening to ports on TCP (+port number):
lsof -iTCP -sTCP:LISTEN -P
- All processes listening to ports on TCP (+process name):
lsof -iTCP -sTCP:LISTEN -n
- All connections to a specific host
lsof -i@
lsof -i@
- All established connections
- process that listens to specific port
lsof -i:8000
- what a given process ID has open
lsof -p [pid]
-------- Netcat --------
Linux: netcat, Mac: nc
- Make a server listening to port
netcat -l 8089
netcat -l localhost 8089
- Connect to a port
netcat 8089
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.