lievenmoors/fine: An efficient interface to the find command - Codeberg.org
This website requires JavaScript.
lievenmoors/fine
Watch
Star
Fork
You've already forked fine
Code
Issues
Pull requests
Activity
An efficient interface to the find command
bash
files
find
fine
linux
search
158 commits
1 branch
0 tags
165 KiB
Shell
100%
main
Find a file
HTTPS
Download ZIP<br>Download TAR.GZ<br>Download BUNDLE
Open with VS Code
Open with VSCodium
Open with Intellij IDEA
lieven moors
e4f525466d
Add option -M (not mime).
2025-12-25 17:11:35 +01:00
COPYING
Add GPL license file.
2025-06-28 17:13:51 +02:00
fine
Add option -M (not mime).
2025-12-25 17:11:35 +01:00
fine_video_script
Make it shorter again.
2025-06-09 18:07:44 +02:00
README.md
Add descriptive sentence.
2025-06-30 10:33:24 +02:00
record_script.sh
Make it shorter again.
2025-06-09 18:07:44 +02:00
README.md
FINE
An efficient interface to the find command
Video Demo: https://youtu.be/8AWNL41Vsyg
1. Introduction
Fine is a shell script written in Bash, that interfaces to the find<br>command. Fine supports many features of find, but wants to reduce complexity.<br>Fine tries to be as simple and ergonomic as possible. Fine reduces typing, in<br>part by using single letter options, but also because of the way it was<br>designed. Fine also adds a couple of features of it's own.
2. Good to know first
a. Search directory arguments
Just like find, fine supports zero or more search directory arguments. If there<br>are none, the current directory is assumed. Search directory arguments have to<br>be specified first, before all the command options.
b. Translating fine commands
Because fine depends so much on find, it has a special option -f (find) .<br>With this option, fine will print the synthesized find command, as the first<br>line of output. This makes it easy to debug fine, but it is also nice when you<br>want to adapt the command for more complex queries.
c. Sorting by default
Many times, it is nice to get sorted output. It makes it easier to find your<br>way round when a long list of files is returned. Moreover, when fine works in<br>verbose mode, you will be able to see the attributes you were filtering on.<br>And they make a lot more sense when they are sorted. The biggest downside is<br>that sorting may be too slow when you are searching big directories.
You can reverse the sort order with the option -o (sort) , or disable<br>sorting with the option -O (disable sort) .
3. Filter options
a. Positive vs. negative filter options
A lot of filter options have a positive and a negative version. The positive<br>version is specified with the lower-case letter, and the negative with an<br>upper-case letter. For example -n (name) vs. -N (not name) .
It is often possible to repeat the same option multiple times. When you use the<br>same positive option multiple times, they will be combined in find with OR. In<br>example: if the filename contains the string a OR the string b, it will be<br>returned. When you use the same negative option multiple times, they will be<br>combined with AND. In example: if the filename does NOT contain the string a<br>AND NOT the string b, it will be returned. Filter options that are different<br>from each other are always combined with AND.
b. Name or path
Fine allows filtering by the name or path of a file with the option -n<br>(name) or -N (not name) .
When people are searching for files, it is very common that they don't know the<br>exact name of the file. That is why fine implicitly adds two * (asterisk)<br>globbing characters (see: man 7 glob ) to the start and end of the search<br>string. But it only adds them when you didn't use any globbing characters in<br>the first place (This behaves in the same way as the locate command). In<br>the following command, "hello" is translated into "*hello*" when the<br>find command is executed.
fine . -n hello
When you want to search for an exact filename, you can use a little trick.<br>When you put one of the letters between square brackets (which is a character<br>class in globbing), fine will search for that exact name.
fine . -n "[h]ello.txt"
When the fine command recognizes a slash (/) in the search string, it will<br>assume that you want to match it against the whole pathname instead.
fine . -n "*/test/hello.txt"
c. Type
Fine allows filtering by file type with the option -t (type) or -T<br>(not type) .
This option needs an argument that consists of one or more type letters. The<br>possible type letters are: "f" (file), "d" (directory), "l" (link), "b"<br>(block), "c" (char), "p" (pipe), "s" (socket), "D" (door)
Here is an example where we search for all files of type "file" and type "link".
fine . -t fl
d. User or group ownership
Search for files (not) owned by a user with -u (user) or -U (not<br>user) , or for files (not) owned by group with -g (group) or -G (not<br>group)
Example: find files owned by user root, but not by the group root.
fine . -u root -G root
e. Permissions
To search for files with or without certain...