The worst Unix program.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


f is the worst possible Unix program. The Unix philosophy says:

  • Write programs that do one thing and do it well.
  • Write programs to work together.
  • Write programs to handle text streams, because that is a universal interface.

More informal principles involve accepting many command line arguments to fine tune execution, outputting as little as possible, not second guessing the user.

f performs file management while doing the exact opposite of each of those principles. It is chatty, doesn't read from stdin, second guesses the user, does too much, has no flags for configuration. It is also surprising useful, replacing (or wrapping) many standard tools.

f [pattern [replacement]] [existing [...]] [new]
f command behaves like
f ls; git status
f directory (with cd directory; ls; git status
f directory (without ls directory; git status
f directory/new mkdir -p directory/new
f file.txt vim file.txt
f /etc/networks sudo vim /etc/networks
f file1.txt file2.txt directory mv file1.txt file2.txt directory
f file1.txt file2.txt directory/new mkdir directory/new && mv file1.txt file2.txt directory/new
f file.tar.gz tar -xvf file.tar.gz
f unzip
f directory .zip zip -r directory
f image.png .jpg convert image.png image.jpg
f text.txt .html pandoc -o text.html text.txt
f "pattern" file1.txt file2.txt grep "pattern" file1.txt file2.txt
f "pattern" directory grep -r "pattern" directory
f "pattern" "replacement" directory find & replace in directory

To install f on your terminal just add the following line to your ~/.bashrc:

[ -f ~/f/ ] && . ~/f/