The Amazing Interactive Command Line Fuzzy Finder (fzf)

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ย. 2024
  • Have you heard of the command line tool 'fzf', aka. the Fuzzy Finder. It's an interactive Unix filter for command-line that can be used with any list. It's similar in concept to graphical tools like 'dmenu' or 'rofi' except 'fzf' is a CLI tool.
    REFERENCED:
    ► github.com/jun...
    WANT TO SUPPORT THE CHANNEL?
    💰 Patreon: / distrotube
    💳 Paypal: www.youtube.co...
    🛍️ Amazon: amzn.to/2RotFFi
    👕 Teespring: teespring.com/...
    DONATE CRYPTO:
    💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
    🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
    📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
    DT ON THE WEB:
    🕸️ Website: distrotube.com/
    📁 GitLab: gitlab.com/dwt1
    🗨️ Mastodon: fosstodon.org/...
    👫 Reddit: / distrotube
    📽️ LBRY/Odysee: odysee.com/@Di...
    FREE AND OPEN SOURCE SOFTWARE THAT I USE:
    🌐 Brave Browser - brave.com/dis872
    📽️ Open Broadcaster Software: obsproject.com/
    🎬 Kdenlive: kdenlive.org
    🎨 GIMP: www.gimp.org/
    🎵 Tenacity: github.com/ten...
    💻 VirtualBox: www.virtualbox...
    🗒️ Doom Emacs: github.com/hli...
    Your support is very much appreciated. Thanks, guys!

ความคิดเห็น • 88

  • @themroc8231
    @themroc8231 ปีที่แล้ว +34

    So cool! I'm glad you saw my question on Mastodon. An important difference with Dmenu or Rofi is you can misspell: fzf can search similar results taking into account interpolations of letters, missing letters, extra letters, etc. That's the "fuzzy" part. Sounds like a detail, but in real life that's what makes it so fast and efficient to use.

  • @MasterHigure
    @MasterHigure ปีที่แล้ว +15

    At my previous workplace, a colleague installed fzf on one of the remote servers, and I discovered that it made ctrl-r a dream. The history search became a LOT easier. I admit I have no idea how he made the bash history search use fzf rather than the default, but it was wonderful.

    • @keyboardwarrior6296
      @keyboardwarrior6296 ปีที่แล้ว +5

      fzf comes with a few scripts that are included /usr/share/fzf/. You just source them in your bashrc or zshrc.

    • @keyboardwarrior6296
      @keyboardwarrior6296 ปีที่แล้ว +3

      The key-bindings scripts come with three keybindings, also. ctrl-r for history, ctrl-t for files under the current dir, and alt-c to cd into dirs under the current dir.

  • @samoylov1973
    @samoylov1973 ปีที่แล้ว +18

    Thanks DT! Here are a few aliases that I use with fzf. They might be useful to others. Especially the ones with preview part
    hf='history -100 |fzf'
    mpf='cd ~/Videos && mpv "$(fzf)"'
    pf='fzf --preview='\''bat --color=always --style=plain {}'\'' --bind k:preview-up,j:preview-down'
    sqf='sqlite3 "$(fzf --prompt "Please select a database: ")"'
    vf='vim "$(fzf --preview="bat --color=always --style=plain {}" --bind K:preview-up,J:preview-down --prompt "Please select a file to edit: ")"'

    • @glidersuzuki5572
      @glidersuzuki5572 ปีที่แล้ว

      You can turn these into functions which check whether the fzf result is empty or not before executing them. So, you won't open the program, eg :- mpv if no results are chosen

    • @samoylov1973
      @samoylov1973 ปีที่แล้ว

      @@glidersuzuki5572 good point. But these ones are aliases. And "mpf" cds into ~/Videos first. I know there are some videos there. So (only after 'cd' to a folder) second program 'mpv' is started.

    • @glidersuzuki5572
      @glidersuzuki5572 ปีที่แล้ว

      @@samoylov1973 I have the alias for vim. But sometimes I decide I have to do something before editing the file and I press ctrl-c but vim opens anyway

    • @samoylov1973
      @samoylov1973 ปีที่แล้ว

      @@glidersuzuki5572 one possible way out is to press CTRL+Z == sends current process to pause state. You can decide what to do with it later. Either you kill it, bring to foreground with fg, or run in the background with bg. Hope, this helps.

  • @n0kodoko143
    @n0kodoko143 ปีที่แล้ว +9

    Thanks as always, Derek!
    A couple of thoughts:
    1. (Use case between dmenu/rofi vs fzf) - if you work in an environment where other consumers of your scripts don't have the xserver/ xserver programs, fzf of bound to the terminal.
    2. I like to use fd or find to get around the issue you experienced where the script only ran in the absolute path.
    i.e: $ fd . ~/wallpaper/ -e jpg | fzf | xargs
    Great thing about programming, so many different ways to a solution!
    Just in case it helps some other viewers (nice touch using sxiv - I think - as a visual filter)

  • @soanvig
    @soanvig ปีที่แล้ว +3

    Fzf has some powerful options allowing you to build custom commands with a dedicated menu bar inside fzf effectively turning it into full blown TUI for many programs that may need it

  • @driden1987
    @driden1987 ปีที่แล้ว +4

    fzf is awesome, changed my workflow so much

  • @glidersuzuki5572
    @glidersuzuki5572 ปีที่แล้ว +2

    Fzf is life. Fzf is love

  • @jaxxarmstrong
    @jaxxarmstrong ปีที่แล้ว +6

    Better late than never, sir 😉😎

  • @mjdstratocaster9716
    @mjdstratocaster9716 ปีที่แล้ว +4

    fzf man page finder/viewer:
    apropos -s 1 . | fzf --preview='man {1}' --preview-window=up
    Scroll with shift-up shift-down
    fzf package finder/info viewer:
    pacman -Q | fzf --preview='pacman -Qi {1}' --preview-window=up
    Can modify for apt, dnf, etc...
    Can add keybindings to install/remove selected package(s).

    • @theodorealenas3171
      @theodorealenas3171 ปีที่แล้ว

      fzf project picker, Emacs inspired:
      cd "$(find ~/projects -name .git -exec basename {} \; | fzf --preview "tree {}")"
      (This is not how I do it, but it used to be how I did it more or less)
      fzf git checkout thing for some reason
      git log --oneline --all --graph | fzf --preview "God knows what" | sed 's/[*/\| ]\(\S\).*/\1/' | xargs git checkout
      I guess. I hope.

  • @sumirandahal76
    @sumirandahal76 ปีที่แล้ว +2

    You always introduce us to the awesome utility.

  • @CiberBago
    @CiberBago ปีที่แล้ว +2

    Thank you, it's a great tool. I needed something like this for a long time but I didn't know how to search for it.

  • @fanaFSF
    @fanaFSF ปีที่แล้ว +10

    Instead of "command ls" you can do it like this: "\ls"

    • @DistroTube
      @DistroTube  ปีที่แล้ว +5

      True, but I'm not usually running Bash. Mostly spend my time in Fish and the backslash trick doesn't work there. But 'command' works everywhere. ;)

    • @ewrietz
      @ewrietz ปีที่แล้ว

      I knew about \ls but not command ls

  • @futz48
    @futz48 ปีที่แล้ว +4

    Cool. I had never heard of fzf. Your home dir had 221K files in it. Mine had over 11 million. This box has been around a long time.

    • @Polar_Onyx
      @Polar_Onyx ปีที่แล้ว

      At that point I'd just do a fresh install, it's not worth your time to sort through all that or to even attempt trimming it down

    • @futz48
      @futz48 ปีที่แล้ว

      @@Polar_Onyx Hahaha! You have no idea. That rig has terabytes of storage - all full (and all well backed up). It's pretty well sorted and organized. No trimming down will happen. I love to collect stuff.

  • @musictube6672
    @musictube6672 ปีที่แล้ว +1

    I've learnt so much from this guy

  • @theodorealenas3171
    @theodorealenas3171 ปีที่แล้ว +2

    COME ON! --preview is the reason of fzf! It's the reason to replace dmenu with a terminal with fzf in it! It can act like NeoVim telescope, or it can give you the manual of the program you're about to run, or a preview of a file, or stats about a system process..

  • @linuxrant
    @linuxrant ปีที่แล้ว +3

    The wallpaper setter combination could work really cool with feh.
    I tried some other day to set a very low-res pixel art wallpapers, but nitrogen was incapable of not making an ugly blur of enlarged pixels.
    Once I learned about feh I was relieved, cos it had a function to remove any ugly blurring from the upscaling. But it was tedious to put all those flags in the feh command...
    a bash script + fzf could make a usefuyl combination of a pixel-art wallpaper chooser :)

    • @eriklundstedt9469
      @eriklundstedt9469 ปีที่แล้ว +1

      I think I wrote a wallpaper setter using fzf a couple of years ago...
      One moment and I'll link it if I find it

  • @Babk0ck
    @Babk0ck ปีที่แล้ว +1

    There's a lot to that program, you can use environment variables to customize its appearance!

  • @xwinglover
    @xwinglover ปีที่แล้ว +2

    That is awesome. Great video man!

  • @dod_ytent9984
    @dod_ytent9984 ปีที่แล้ว +2

    I will use this more than sed/awk for sure. Thanks for the great video D.

    • @terrydaktyllus1320
      @terrydaktyllus1320 ปีที่แล้ว

      I don't understand the comment - fzf, sed and awk do completely different things anyway, one does not replace the other two for any reason that I can think of.

    • @dod_ytent9984
      @dod_ytent9984 ปีที่แล้ว +1

      @@terrydaktyllus1320 I mean utility wise, I use fzf more than sed or awk, not as a replacement.

    • @terrydaktyllus1320
      @terrydaktyllus1320 ปีที่แล้ว

      @@dod_ytent9984 "I will use this more than sed/awk for sure."
      I am just holding up a mirror to your own words - and what concerns me more is if you think sed and awk are "alternatives" to fzf, then you really can't know sed and awk that well in the first place.
      "fzf" = "fuzzy file finder", it finds files, like "find" does.
      "sed" and "awk" allow pattern matching and string replacement *INSIDE* files, i.e. once you have found the files.
      So do you understand now?

    • @dod_ytent9984
      @dod_ytent9984 ปีที่แล้ว

      @@terrydaktyllus1320 ok, i will try my best to be more clear. I know what sed, awk and fzf do, and i know that each perform separate functions. I meant to say, in my day to day, i need what fzf does more than what sed/awk does, thus i use it more than I do sed/awk. Along with that this was a callback to DT's awk and sed tutorials.

    • @terrydaktyllus1320
      @terrydaktyllus1320 ปีที่แล้ว

      @@dod_ytent9984 You don't need to explain yourself, it's just important to be factually correct.
      Someone corrected me the other day because I was wrong about something I said about ARM CPUs - I also say incorrect things sometimes too!

  • @marcins.7445
    @marcins.7445 7 หลายเดือนก่อน

    Guys, more people need to sponsor fzf. It has 57k stars and only 50 sponsors!!

  • @sys7emH4cked
    @sys7emH4cked ปีที่แล้ว +1

    Great Tutorial, DT! 👍

  • @ratchetwise440
    @ratchetwise440 9 หลายเดือนก่อน

    Fuzzy finder. I'm old. I was thinkin' Craigslist personalzzz

  • @diveallz1044
    @diveallz1044 9 หลายเดือนก่อน

    I wish i was like DistroTube in the aspect of being able to keep up with all those folders/files in my home directory😅. Normally if i dont need it for daily use i just put it on a flash drive😂

  • @MauricioLuisdeMedeiros
    @MauricioLuisdeMedeiros ปีที่แล้ว +1

    Seriously DT?!?! You have this Ubuntu Compiz video sitting on your home folder since 2014? Was it an Easter egg?

  • @zenitsu2989
    @zenitsu2989 ปีที่แล้ว +1

    With you onboard linux still is an interesting section to explore.

  • @terrydaktyllus1320
    @terrydaktyllus1320 ปีที่แล้ว

    Thank you for this extremely useful video - I don't always agree with everything you say but it's your channel and "you do you" - but I hadn't ever considered using fzf until your video today explained it so well, and that's from someone who started with Linux back in 1996!
    I've just realised how useful fzf actually is.... though vim is still better than emacs!

    • @eriklundstedt9469
      @eriklundstedt9469 ปีที่แล้ว

      I've written a "library" in fennel (works for fennel and lua) so that I can use lisp (fennel is lisp that works like lua) to write shell scripts using fzf.
      I personally prefer Emacs over neovim though but if you are comfortable with lua, that's good

  • @zinoubensalah8939
    @zinoubensalah8939 ปีที่แล้ว +1

    Hey DT! when are you gonna inspect Hyprland ? i think it's still needs some work but i was hoping to see your perspective on it.

  • @Tuishimi
    @Tuishimi ปีที่แล้ว

    That is a useful tool I was unaware of.

  • @idjdbrvvskambvvv9007
    @idjdbrvvskambvvv9007 ปีที่แล้ว

    d menu +fzf is unbeatable

  • @HelmutFischer-thehefi
    @HelmutFischer-thehefi ปีที่แล้ว +1

    Very helpful! Thx!

  • @WippSheridan
    @WippSheridan หลายเดือนก่อน

    We all want a fuzzy finder but as long as it doesn't take screenshots

  • @cesar1087
    @cesar1087 ปีที่แล้ว

    How do I get the sugestions when you start typing? Is this another tool?

  • @omarabdelhameed349
    @omarabdelhameed349 ปีที่แล้ว

    Thanks D,
    ma I ask which keyboard is this?

  • @felipemachado4323
    @felipemachado4323 ปีที่แล้ว

    How do you do to get command suggestions on terminal?

  • @anon_y_mousse
    @anon_y_mousse ปีที่แล้ว +1

    Apparently I downloaded a copy of this last year and never installed it. I guess this'll be the push to play with it.

    • @terrydaktyllus1320
      @terrydaktyllus1320 ปีที่แล้ว

      I'm the same - I knew of it and took the attitude "maybe I'll check it out some time" but it took his demo here to make me realise how useful fzf can actually be. To give Brodie Robertson some credit too, he did a video on it a few years ago and that's also worth a watch.

  • @muddyexport5639
    @muddyexport5639 ปีที่แล้ว

    Cool vid. Thanks!

  • @matt92hun
    @matt92hun ปีที่แล้ว

    You can make terminal apps run in the background with Ctrl+Z.

  • @postmaster-p
    @postmaster-p ปีที่แล้ว +2

    CP3🙌

  • @PrabhuKumar-er5fo
    @PrabhuKumar-er5fo ปีที่แล้ว

    Is there any fork with fzf with vim simple navigation

  • @heroe1486
    @heroe1486 ปีที่แล้ว

    nice video thanks

  • @valentynmudryk2869
    @valentynmudryk2869 10 หลายเดือนก่อน

    I can't use two fzf in one command

  • @brickviking667
    @brickviking667 ปีที่แล้ว

    "...calculate about two hundred and twenty thousand files...". I can't do that on my system. I'm over 2.5 million and counting...fzf hasn't stopped yet.

  • @5ebastiancarlo5
    @5ebastiancarlo5 ปีที่แล้ว

    hey dt do a video about where to split windows: window managers, terminal multiplexes, vim/emacs windows, all off them?

  • @Axlefublr
    @Axlefublr ปีที่แล้ว +1

    I *just* recorded two videos on this lmaooo

    • @terrydaktyllus1320
      @terrydaktyllus1320 ปีที่แล้ว +2

      There's some interesting-looking content in your channel, thanks for the heads-up.

    • @Axlefublr
      @Axlefublr ปีที่แล้ว

      @@terrydaktyllus1320 Thank you! I hope it's gonna be useful to you :)
      There's a playlist on Linux related things, and also one on neovim if you use that / are interested in figuring it out

  • @KirbyZhang
    @KirbyZhang ปีที่แล้ว

    how can you remember these commands if you're not doing system administration everyday?? that's what kept me away from Linux. It's fun when you learn it the first time, but too much knowledge needs to be ingrained and maintained, to do uncommon things.
    that's why I'm interested in there being a hybrid text-graphical interface, where mouse and keyboard form separate focus cursors. as you type the graphics change to show the content and the options, you can click to add to the text, without losing focus.
    this would be a new compositor/server based on Wayland and Weston.

    • @terrydaktyllus1320
      @terrydaktyllus1320 ปีที่แล้ว +1

      "how can you remember these commands if you're not doing system administration everyday??"
      You make notes, read man pages and/or create web bookmarks to the sites or searches that you use regularly. I started with UNIX-like systems 30 years ago and I still do just that, I don't even try to remember everything.
      Plus you can use shell aliases or "one line shell scripts" to shorten longer commands also.
      Linux just gives you "a box of tools", you have to learn how to use those tools.

  • @ecavero1
    @ecavero1 ปีที่แล้ว

    I started using this in Vim. Then, I kinda knew how to pipe things into fzf to search for things instead of files. But I totally forgot that fzf sent the ouput to stdout!

    • @anon_y_mousse
      @anon_y_mousse ปีที่แล้ว

      Okay, but why do you have a problem with stdout? Did it steal your /dev/random and give you predictable output?

    • @ecavero1
      @ecavero1 ปีที่แล้ว

      @@anon_y_mousse I didn't have a problem with it. It simply did not occur to me I could pipe the output from fzf to another program, like mpv, for example!
      Anyway, now I know.

    • @anon_y_mousse
      @anon_y_mousse ปีที่แล้ว

      @@ecavero1 So if it sent it to stderr you wouldn't have liked to use it? I can understand that complaint, I hate having to redirect stderr for such programs, ffprobe being a prime example of such annoyance.

  • @sebaszwarc
    @sebaszwarc 10 หลายเดือนก่อน

    Problem with these powerfull tools is in ordinary life you very rarely have usecase for this

  • @PatriciaPuskas-l4s
    @PatriciaPuskas-l4s 4 วันที่ผ่านมา

    King Knoll

  • @DeborahRobinson9Lopez-h1s
    @DeborahRobinson9Lopez-h1s 10 วันที่ผ่านมา

    Bashirian Way

  • @JonathanSteadman2003
    @JonathanSteadman2003 ปีที่แล้ว

    Hey distrotube, you are the greatest youtuber ever. Thanks for your support on our open source software and community. It means the world to me and billions of other people.
    Robonuggie has played my games before and that was amazing. So yeah, I just love making open source projects.

  • @AndreiRobertYTlolYes
    @AndreiRobertYTlolYes ปีที่แล้ว +2

    Hey new Linux Trisquel 11.0 2023

  • @DelbertOsaki-h2y
    @DelbertOsaki-h2y 2 วันที่ผ่านมา

    Aniya Village

  • @DelilahMielczarek-k7j
    @DelilahMielczarek-k7j 7 วันที่ผ่านมา

    Roberts Circle

  • @BunyanGenevieve
    @BunyanGenevieve 6 วันที่ผ่านมา

    482 Roberto Plaza

  • @ElArboool
    @ElArboool ปีที่แล้ว

    Zed*

  • @DonovanInocencio-u3i
    @DonovanInocencio-u3i 17 ชั่วโมงที่ผ่านมา

    Lesch Loop

  • @IvethFonsecaop
    @IvethFonsecaop 10 วันที่ผ่านมา

    Garcia Mark Perez Eric Young Frank

  • @PriceNelly-c1p
    @PriceNelly-c1p 9 วันที่ผ่านมา

    Botsford Union

  • @sbr895
    @sbr895 ปีที่แล้ว +1

    First.

    • @lqlarry
      @lqlarry ปีที่แล้ว +1

      I missed it by that much.

  • @MerkDolf
    @MerkDolf ปีที่แล้ว

    Ah,

  • @fabricio4794
    @fabricio4794 ปีที่แล้ว

    I Hate Command Lines