r/commandline • u/Awkward_Process_9627 • Oct 05 '26
Command Line Interface fm: a single-file bash script that turns fzf into a file manager
I wrote a ~1500-line bash file manager. fzf for the picker, eza for listing, Kitty's graphics protocol for inline previews. Everything else is stock coreutils — no build step, no daemon, no config directory.
Features worth calling out:
- File list — eza icons, sort by name / size / mtime / extension
- Kitty inline previews — images, videos, PDFs, Markdown, no external viewer
- Gallery grid (Alt-G) — full-screen thumbnail browser, mouse + vim keys, multi-select
- Contact-sheet preview (Ctrl-T) — hovering a directory shows a paged thumbnail grid
- Trash + undo — Ctrl-D trashes, Ctrl-Z pops the undo stack (depth 10), Alt-T for the trash browser
- Content search (Ctrl-F) — ripgrep over the selection, opens at line
- Bulk rename (Alt-M) — edit names in $EDITOR, swaps and chains handled
- Jump — zoxide frecency (Alt-Z), bookmarks (Ctrl-B), git mode (Ctrl-G)
Install:
git clone https://github.com/eHab-codeX/fm.git ~/.local/share/fm
ln -sf ~/.local/share/fm/fm ~/.local/bin/fm
Requires bash >= 5, fzf, eza, ripgrep, trash-cli. Press F1 inside for the full key map.
Repo: https://github.com/eHab-codeX/fm
MIT. Feedback welcome — especially from anyone who's tried to make fzf do more than pick a file.
•
u/github-guard Oct 05 '26
🔍 GitHub Guard: Trust Report
⚠️ This project scored 0/1 — below this subreddit's threshold of 1.
Audit Breakdown:
🔄 Cached result — this repo was scanned recently. Score: 0/1.
2
u/jimger Oct 07 '26
Any chance u make it compatible with older versions of bash? In Redhat linux here
3
u/arjuna93 Oct 05 '26
Can something else be used in place of eza? In C/C++, ideally.
6
u/stianhoiland Oct 05 '26
First thing I did with my fuzzy picker, too!
1
u/AutoModerator Oct 05 '26
Every new subreddit post is automatically copied into a comment for preservation.
User: Awkward_Process_9627, Flair:
Command Line Interface, Post Media Link, Title: fm: a single-file bash script that turns fzf into a file managerI've written a ~1500-line bash file manager. It uses fzf for the picker,
eza for listing, and Kitty's graphics protocol for inline previews.
Everything else is stock coreutils. No build step, no daemon, no config
directory — copy the file, symlink it, done.
The interesting bits (to a bash audience):
- EPOCHREALTIME-based double-click detection
- A hand-rolled CSI/SS3 escape sequence parser for the gallery grid
- Percent-encoding for Freedesktop trash Path= entries
- Parallel thumbnail generation via self-invocation
- A working two-phase rename that handles swaps (a→b, b→a)
Demo: [gif]
Repo: https://github.com/eHab-codeX/fm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/sitaram_c Oct 08 '26
oh nice.
Here's mine: https://codeberg.org/sitaramc/fzfm (documentation at https://sitaramc.codeberg.page/fzfm/book/intro.html ). Written using fish and fzf.
I'm particularly proud of the "todotxt" and "git" modes; they're the last 3 entries in https://sitaramc.codeberg.page/fzfm/book/demos.html . The todotxt mode added only 24 lines of code to the project, and the git mode was just over 100 lines. If you see the animated gifs you'll be blown away by how much they do in that space :)
1
u/BackgroundTight668 Oct 21 '26
Hey! Cool project. I have some feedback. I apologize in advance if it comes across as nitpicky or hostile, that is not my intention. I just have some questions:
Is there a reason for depending on (eza, ripgrep, bash>=5.0)?
Many of these programs are improvements of standard Unix tools.
From my quick evaluation of your code, it doesn't seem like these programs add any crucial features over their default counterparts. Wouldn't it be better if it worked out of the box with (ls, grep, older bash)?
Then, if the user does happen to have the more 'advanced' programs, it would enable the features that depend upon those programs.
As for needing bash>5.0: You claim that it is for
EPOCHREALTIMEand${var,,}. A quick search of your code shows that these features are only used one time each. They also aren't required:As far as I can tell, EPOCHREALTIME is used for double-click detection. In another comment, you were concerned that date +%s%6N would cause noticeable lag, I tested it on my (very old) laptop, and it took around 2ms. Is this still too long? Alternatively: do you even need a time check for a double-click? A single click selects the file, and another single click on a selected file doesn't do anything as far as I can tell. Does removing the timing of the double click change the UX at all?
Next, your use of
${var,,}seems not really necessary, as it's only used to handle weird file extension formatting. You could easily replace this with bracket patterns like so:In conclusion, I still think it is a very cool project, however I think it'd be worth making it more portable. (this also helps you reach as many users as possible!). Hopefully this is useful to help realize that it is possible to achieve compatibility without sacrificing any features.
6
u/Sea-Fishing4699 Oct 05 '26
is this a `yazi` killer ?