The fd
command, fast for “uncover list,” is designed to seem and discover files and directories all the way through the filesystem. It’s identified for its simplicity and tempo, making it a favorite among tool administrators and developers alike.
Compared to the usual discover
command, fd
supplies a further user-friendly syntax and faster search purposes. It’s regularly used for locating specific files, cleaning up directories, or even in automation scripts. Additionally, the fd
command will also be paired with other directions like grep
for additonal difficult search capacity.
Learn to Arrange the fd
Command
fd
isn’t normally built-in by the use of default in most Linux distributions, so it is very important arrange it. The arrange process can vary depending on the distribution you’re the usage of. Proper right here’s the way you’ll arrange and uninstall fd
on some no longer abnormal distributions:
Ubuntu/Debian
To place in fd
on Ubuntu or Debian, you’ll use the following command:
sudo apt-get exchange sudo apt-get arrange fd-find
To uninstall it later, you’ll use:
sudo apt-get remove fd-find
Fedora
On Fedora, you’ll arrange fd
with:
sudo dnf arrange fd-find
To uninstall it:
sudo dnf remove fd-find
macOS (the usage of Homebrew)
Whilst you’re on macOS and the usage of Homebrew, you’ll arrange fd
with:
brew arrange fd
To uninstall it:
brew uninstall fd
Follow: the package deal deal identify might be fd-find
in some package deal deal managers, and also you’ll want to use the command fdfind
as an alternative of fd
. You’ll alias it to fd
by the use of together with alias fd=fdfind
on your shell’s configuration report (e.g., .bashrc
or .zshrc
).
Learn to Use fd
1. Search for Knowledge by the use of Establish
Syntax: fd PATTERN
Explanation: Searches for files and directories with a name matching the given development.
Example: fd 'report.txt'
Output:
/space/individual/bureaucracy/report.txt /space/individual/archive/report.txt
The command searches for all occurrences of report.txt
inside the provide list and its subdirectories, file the whole paths to the files.
2. Search for Knowledge with a Specific Extension
Syntax: fd '.*EXTENSION'
Explanation: Searches for files with a selected extension.
Example: fd '.*.pdf'
Output:
/space/individual/bureaucracy/file1.pdf /space/individual/bureaucracy/file2.pdf
The command searches for all PDF files inside the provide list and its subdirectories.
3. Search for Knowledge Modified inside the Ultimate N Days
Syntax: fd --changed-within 'Nd'
Explanation: Searches for files and directories replaced all the way through the last N days.
Example: fd --changed-within '7d'
Output:
/space/individual/bureaucracy/week_report.docx /space/individual/pictures/recent_image.jpg
The command lists all files and directories replaced all the way through the last 7 days.
4. Search for Directories Best possible
Syntax: fd --type d PATTERN
Explanation: Searches for directories with a name matching the given development.
Example: fd --type d 'tasks'
Output:
/space/individual/construction/tasks /space/individual/design/tasks
The command searches for all directories named tasks
inside the provide list and its subdirectories.
5. Search for Knowledge Apart from Positive Directories
Syntax: fd --exclude DIR PATTERN
Explanation: Searches for files and directories matching the rage, with the exception of specified directories.
Example: fd --exclude 'archive' 'report.txt'
Output:
/space/individual/bureaucracy/report.txt
The command searches for report.txt
then again excludes any results from the “archive” list.
6. Search for Knowledge More than a Specific Measurement
Syntax: fd --size '+SIZE'
Explanation: Searches for files higher than a specified duration.
Example: fd --size '+1M'
Output:
/space/individual/films/large_video.mp4 /space/individual/track/big_album.flac
The command lists all files higher than 1 megabyte inside the provide list and its subdirectories.
7. Search for Knowledge and Execute a Command on Them
Syntax: fd PATTERN -x COMMAND
Explanation: Searches for files matching the rage and executes a specified command on them.
Example: fd '.*.txt' -x cat
Output:
Contents of file1.txt Contents of file2.txt
The command searches for all text files and then runs the cat
command on them, appearing their contents.
8. Search for Knowledge in a Case-Insensitive Method
Syntax: fd --ignore-case PATTERN
Explanation: Searches for files and directories matching the rage, ignoring case.
Example: fd --ignore-case 'readme'
Output:
/space/individual/README /space/individual/tasks/readme.md
The command searches for all occurrences of readme
inside the provide list and its subdirectories, ignoring the case.
9. Search for Knowledge The usage of a Not unusual Expression
Syntax: fd --regex 'REGEX'
Explanation: Searches for files and directories matching a given not unusual expression.
Example: fd --regex '^a.*.txt$'
Output:
/space/individual/bureaucracy/a_file.txt /space/individual/bureaucracy/another_file.txt
The command searches for all text files inside the provide list and its subdirectories that get began with the letter a
.
10. Search for Knowledge with Specific Permissions
Syntax: fd --perm PERMISSIONS
Explanation: Searches for files with specific permissions.
Example: fd --perm 755
Output:
/space/individual/scripts/executable_script.sh
The command searches for files with permissions set to 755
(be told, write, and execute for the owner; be told and execute for the group and others).
Further Linux directions:
Checklist Operations | rmdir · cd · pwd |
Document Operations | cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip |
Document Machine Operations | chown · mkfs |
Networking | ping · curl · wget · iptables |
Search and Text Processing | discover · grep · sed · whatis |
Machine Wisdom and Regulate | env · historical past · best · who |
Particular person and Session Regulate | display · su · sudo |
The put up Learn how to Use the ‘fd’ Command in Linux gave the impression first on Hongkiat.
Supply: https://www.hongkiat.com/blog/linux-command-fd/
Contents
- 0.0.1 Learn to Arrange the fd Command
- 0.0.2 Learn to Use fd
- 0.0.2.1 1. Search for Knowledge by the use of Establish
- 0.0.2.2 2. Search for Knowledge with a Specific Extension
- 0.0.2.3 3. Search for Knowledge Modified inside the Ultimate N Days
- 0.0.2.4 4. Search for Directories Best possible
- 0.0.2.5 5. Search for Knowledge Apart from Positive Directories
- 0.0.2.6 6. Search for Knowledge More than a Specific Measurement
- 0.0.2.7 7. Search for Knowledge and Execute a Command on Them
- 0.0.2.8 8. Search for Knowledge in a Case-Insensitive Method
- 0.0.2.9 9. Search for Knowledge The usage of a Not unusual Expression
- 0.0.2.10 10. Search for Knowledge with Specific Permissions
- 0.0.2.11 Further Linux directions:
- 0.1 Related posts:
- 1 Is it Price The usage of ChatGPT to Write Your Resume? Let’s In finding Out
- 2 Divi Product Highlight: Divi Timeline Layouts Pack
- 3 10 Perfect WordPress Plugins For 2025 (Unfastened and Paid)
0 Comments