Install fd Command for Finding Files on Raspberry Pi

Install fd Command for Finding Files on Raspberry Pi

The fd is a tool that enables to find files in a directory hierarchy via command line. This tool can be used as an alternative to the find command.

This tutorial shows how to install fd command on Raspberry Pi.

Install fd

Connect to Raspberry Pi via SSH. Retrieve the latest version tag of fd release from GitHub. Assign version tag to variable:

FD_VERSION=$(curl -s "https://api.github.com/repos/sharkdp/fd/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')

Run the following command to download Debian package (.deb) from releases page of the fd repository:

curl -Lo fd.deb "https://github.com/sharkdp/fd/releases/latest/download/fd_${FD_VERSION}_armhf.deb"

Install fd:

sudo apt install -y ./fd.deb

Once installation is completed, we can check version of fd:

fd --version

Remove unnecessary .deb package:

rm -rf fd.deb

Testing fd

The fd command has many uses cases. For example, the following command allows to search for files and directories in a given directory:

fd hosts /etc

An example of output:

/etc/avahi/hosts
/etc/hosts
/etc/hosts.allow
/etc/hosts.deny

Uninstall fd

If you want to completely remove fd, run the following command:

sudo apt purge --autoremove -y fd

Leave a Comment

Cancel reply

Your email address will not be published.