Table of Contents
Introduction
In this tutorial, how to use the fd command in Linux. fd command-line tool to find files in the file system. this tool is very simple.
The “fd” command is not a standard command in Linux. It seems that you might be referring to a specific command that is not part of the core Linux utilities.
What is the ‘fd’ Command?
The ‘fd’ command is a powerful and user-friendly tool that facilitates file searches within the Linux file system.
Although not a native Linux command, it is often considered a better and more intuitive alternative to the ‘find’ command. ‘fd’ is built on Rust, which contributes to its speed and efficiency.
Install fd command
Before you can start using ‘fd’, you need to install it on your Linux system. In this section, we’ll cover how to install ‘fd’ using popular package managers like ‘apt’ and ‘yum’, as well as from source.
Using apt to install fd on Ubuntu Server.
sudo apt-get install fd-find
(Optional) Create an alias for fd that refers to fdfind.
alias fd=fdfind
(Optional) To make the alias permanent.
vi ~/.bashrc
#Add this entry to the bashrc file
alias fd=fdfind
Use the fd command in Linux
Before using the fd command in Linux, we need to read the help of the command.
# fd --help
The output terminal as below
Find all files and directories starting with “abc” followed by any number of digits, you can use the following command:
fd -e "^abc\d+"
find all files that were changed before a specified number of days
$ fd index /home/vagrant --changed-before 365d
Finding Files Inside a Specific Directory
$ fd password /etc
Finding Files Based on Extension
$ fd -e html
Finding Hidden Files
$ fd -H bash
More details information about fd command.
man fd
Conclusion
fd command is a simple command in Linux. It uses the number of lines of files. These are just a few examples of how you can use the “fd” command.
For more advanced usage and options, you can refer to the documentation or help of the specific “fd” implementation you have installed on your system, as there are multiple versions available. Thank you for reading the DevopsRoles page!