What is Percol?
Percol is a Python utility for unix that adds an interactive selection menu to your terminal. This menu can be generated instantly just from piping from a different command.
If I missed your favorite way of using percol, please send me a tweet and I’ll add your suggestions to this list.
Common UNIX Stuff
Search a File
percol /path/to/file
Changing Directories
cd $(ls -ARd */ | percol)
Killing Processes
ps aux | percol | awk '{ print $2 }' | xargs kill
Run a Command from History
eval $(history | cut -c 8- | percol)
Search grep
Results
grep -R "needle" haystack/
Open grep
Result File with vim
vim $(grep -R 'needle' haystack/ | percol | awk -F ':' '{print $1}')
Parsing diff
Output
diff file1 file2 | percol
Search for alias
alias | percol
Choose User for File Ownership
sudo chown $(cut -d: -f1 /etc/passwd | percol) file
Choose Group for File Ownership
sudo chgrp $(groups | tr " " '\n' | percol) file
Percol with Docker
Choose Running Container to Stop
docker stop $(docker ps | percol | awk '{print $1;}')
Choose Stopped Container to Start
docker start $(docker ps --filter 'status=exited' | percol | awk '{print $1;}')
Choose Container to Remove
docker rm $(docker ps -a | percol | awk '{print $1;}')
Choose Image to Remove
docker rmi $(docker images | percol | awk '{print $3;}')