Skip to content

Instantly share code, notes, and snippets.

@Mimickal
Created July 13, 2019 01:32
Show Gist options
  • Save Mimickal/a563ca6f4c79aef8ec504327647f86ce to your computer and use it in GitHub Desktop.
Save Mimickal/a563ca6f4c79aef8ec504327647f86ce to your computer and use it in GitHub Desktop.
Fuzzy find scripts
#!/bin/bash
# This file contains a bunch of bash functions that use fzf (fuzzy find) to
# create more interactive UIs for existing utilities.
# cd into directory the selected file lives in
function fcd() {
file="$(locate --nofollow /* | fzf)"
path=$(dirname "$file")
cd "$path"
}
# Kills selected process by ID
function fkill() {
kill $(ps fux | fzf | sed 's/[a-zA-Z]* *\([0-9]*\).*/\1/')
}
@Mimickal
Copy link
Author

You can use this is by putting source fuzzies.sh in your .bashrc (or whatever equivalent for your shell). These functions become available like any other CLI program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment