Last active
August 29, 2015 14:09
-
-
Save neilberget/1588f136847ed40afcd4 to your computer and use it in GitHub Desktop.
Selecta Aliases
This file contains hidden or 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
# Kill a process | |
alias zap="ps aux | tail -n+2 | selecta | tr -s ' ' | cut -d ' ' -f 2 | xargs kill" | |
# Kill a process with -9 | |
alias zap9="ps aux | tail -n+2 | selecta | tr -s ' ' | cut -d ' ' -f 2 | xargs kill -9" | |
# cd into an arbitrarily deep subdirectory. Don't try in directories with too many subdirectories (e.g. $HOME) | |
alias sd='cd $(find * -type d | selecta)' | |
# Create a ~/.sshto file with a list of hosts (or user@hosts) you commonly ssh to. | |
alias sshto='ssh $(selecta < ~/.sshto)' | |
# Docker shortcuts | |
alias dpicker="docker ps | tail -n+2 | selecta | cut -d' ' -f1" | |
alias dstop="dpicker | xargs docker rm -f" | |
alias dtail="dpicker | xargs docker logs -f" | |
alias dtop="dpicker | xargs docker top" | |
alias dinspect="dpicker | xargs docker inspect" | |
# Run a make target | |
maketargets() { | |
make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | |
} | |
alias makes="maketargets | selecta | xargs make" | |
# Run a single spec file | |
alias spec1="find spec -type f | selecta | xargs bundle exec rspec" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Selecta is a pretty useful command line utility for fuzzy selecting from a list.
This is my list of aliases that use selecta.