# TODO: detect color support and enable/disable color in aliases based on that. # File Manipulation # TODO: bash ls doesn't need -G or maybe macs don't. Figure that out and use that test here. alias ls='ls -G --color=auto' alias lsd='ls -G --color=auto -d' alias ll='ls -G --color=auto -l' alias lld='ls -G --color=auto -l -d' alias lsg='ls | grep --color' alias llg='ls -l| grep --color' alias ln='ln -ivw' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' alias slash='ls -SlAhr' alias slasher='ls -SlAh' alias slashed='ls -SlAhrd' alias ds='function f() { du -h -d 1 $* | sort -h | tee ~/dirsize ; unset -f f; }; f' alias dud='function { du -h -d 1 $* | sort -h }' alias dud='function f() { du -h -d 1 "$@" 2>/dev/null | sort -h ; unset -f f; }; f' alias dudr='function { du -h -d 1 $* | sort -h -r }' alias dudr='function f() { du -h -d 1 "$@" 2>/dev/null | sort -h -r ; unset -f f; }; f' alias mvn='mv -n' alias gmv='mv $* ~/Google\ Drive/My\ Drive/' alias gmvn='mv -n $* ~/Google\ Drive/My\ Drive/' alias omv='mv $* ~/OneDrive/' alias omvn='mv -n $* ~/OneDrive/' alias mv='mv -i' alias rm='rm -i' alias rs='rsync -avhz --progress' alias rsfat='rs --no-perms --no-owner --no-group --no-times' alias md=mkdir alias rd=rmdir # Git shortcuts alias it=git alias rsgit='rsync -avhz --no-perms --exclude='\''.git'\'' --exclude='\''.vscode'\' # Bazel shortcuts alias refresh_bazel='bazel run @hedron_compile_commands//:refresh_all' alias bb='bazel build //...' alias bt='bazel test //...' alias bq='bazel query //...' alias br='bazel run @hedron_compile_commands//:refresh_all' alias cbb='clear && bazel build //...' alias cbt='clear && bazel test //...' alias cbq='clear && bazel query //...' # Utilities alias iwyu='include-what-you-use' alias show-android-emulators="ps aux | head -n 1 && ps aux | grep avd | sed '$d'" alias kill-all-android-emulators='adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done' alias freespace="df -I -h -T nodevfs | grep -i -v -E '/\.timemachine/|/System/Volumes/|/com\.apple\.TimeMachine\.localsnapshots/' | sed -e 's/ / /g'" alias fs="df -I -h -T nodevfs | grep -i -v -E '/\.timemachine/|/System/Volumes/|/com\.apple\.TimeMachine\.localsnapshots/' | sed -e 's/ / /g'" alias hashes='md5deep -r' # Mac equivalent of lsusb on linux alias lsusb='system_profiler SPUSBDataType' alias tea='tee -a' alias find_recent='function { find . $* -exec ls -ltr {} + }' alias find_recent='function f() { find . $* -exec ls -ltr {} + ; unset -f f; }; f' # In Development # Dosn't work if command is piped e.g. `log_and_do "ls | tee out.txt" my_other_file.txt` # or stdout is redirected e.g. `log_and_do "ls > out.txt" my_other_file.txt` alias log_and_do='function { `echo "# $1 >> $2\n" > $2 && echo $1` >> $2 }' # This should get the PIDs of any avd commands running and kill-9 them and then do the # same as kill-all-android-emulators to clean them up after. # alias kaae="kill -9 `ps aux | grep avd | sed '$d' | cut -f 2 -w` > /dev/null" # TODO: Stuff I don't know why other configs setup #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' #alias ll='ls -alF' #alias la='ls -A' #alias l='ls -CF' # From Bash on Ubuntu # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert #alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' # WSL Specific #alias pbcopy=clip.exe #alias pbpaste="powershell.exe -noprofile Get-Clipboard" # SSH-Agent setup # alias sshgo='eval $(ssh-agent -s) && ssh-add ~/.ssh/id_ed25519 ~/.ssh/id_rsa ~/.ssh/id_win_ed25519 ~/.ssh/id_win_rsa' alias sshgo='eval $(ssh-agent -s) && for key in ~/.ssh/id_*; do [[ -f "$key" && "${key##*/}" != *.* ]] && ssh-add "$key"; done'