dot-files/bash/aliases
Buddy Sandidge 7fa6ac9318 Update deepgrep from alias to function
The latest version of macOS did not play well with the version of
deepgrep that piped find to xargs. Replaced it with version to use exec
feature of find.
2020-01-24 12:55:07 -08:00

62 lines
1.8 KiB
Bash

#!/usr/bin/env bash
music_dir='~/music'
desktop_dir='~/desktop'
docs_dir='~/documents'
# Aliases for OS X
if [[ $(uname) == Darwin ]]; then
music_dir='~/Music'
desktop_dir='~/Desktop'
docs_dir='~/Documents'
alias ls='ls -G'
fi
if [[ $(uname) == Linux ]]; then
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Move around to common locations
alias desktop="cd $desktop_dir"
alias podcasts="cd ~/podcasts"
alias code='cd ~/code/ '
alias music="cd $music_dir"
alias documents="cd $docs_dir"
unset -v music_dir
unset -v desktop_dir
unset -v docs_dir
# Some common aliases
alias ll='ls -alF'
alias df='df -h'
alias du='du -h'
alias curl='curl --proto-default https --silent '
# Shorthand helpers
alias 644='chmod 644 '
alias 755='chmod 755 '
alias 600='chmod 600 '
alias 700='chmod 500 '
alias +x='chmod +x '
alias ..='cd .. '
# Some specialty aliases
alias meminfo='vmstat -s -S M | grep mem'
alias wget-opendir='wget -r -l 0 -c -nc -np -e robots=off --random-wait --limit-rate=800000k --reject=html,htm,index'
alias rsync-win='rsync --recursive --verbose --times --modify-window=1 '
alias can-upgrade='sudo apt-get update && sudo apt-get upgrade -y '
alias can-find='aptitude search '
alias can-haz='sudo apt-get install '
alias take='sudo chown $(whoami):$(whoami) '
alias simple-http-server='python3 -m http.server'
alias numfiles='find . -maxdepth 1 -type f | wc -l'
alias slugify="sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z"
# Show list of git branches
alias git-br='for k in `git branch|perl -pe s/^..//`; do echo -e ` git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r'