The Amazing Interactive Command Line Fuzzy Finder (fzf)

Поділитися
Вставка
  • Опубліковано 4 лис 2024

КОМЕНТАРІ • 102

  • @themroc8231
    @themroc8231 Рік тому +35

    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 Рік тому +19

    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)

  • @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.

  • @driden1987
    @driden1987 Рік тому +4

    fzf is awesome, changed my workflow so much

  • @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

  • @glidersuzuki5572
    @glidersuzuki5572 Рік тому +2

    Fzf is life. Fzf is love

  • @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

  • @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.

  • @jaxxarmstrong
    @jaxxarmstrong Рік тому +6

    Better late than never, sir 😉😎

  • @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 Рік тому +1

      @@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.

  • @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

  • @musictube6672
    @musictube6672 Рік тому +1

    I've learnt so much from this guy

  • @marcins.7445
    @marcins.7445 9 місяців тому

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

  • @Babk0ck
    @Babk0ck Рік тому +1

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

  • @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!

  • @xwinglover
    @xwinglover Рік тому +2

    That is awesome. Great video man!

  • @Tuishimi
    @Tuishimi Рік тому

    That is a useful tool I was unaware of.

  • @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.

  • @sys7emH4cked
    @sys7emH4cked Рік тому +1

    Great Tutorial, DT! 👍

  • @idjdbrvvskambvvv9007
    @idjdbrvvskambvvv9007 Рік тому

    d menu +fzf is unbeatable

  • @zenitsu2989
    @zenitsu2989 Рік тому +1

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

  • @diveallz1044
    @diveallz1044 11 місяців тому

    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😂

  • @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..

  • @Marc-Tu
    @Marc-Tu 2 місяці тому

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

  • @ratchetwise440
    @ratchetwise440 11 місяців тому

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

  • @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

  • @MauricioLuisdeMedeiros
    @MauricioLuisdeMedeiros Рік тому +1

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

  • @omarabdelhameed349
    @omarabdelhameed349 Рік тому

    Thanks D,
    ma I ask which keyboard is this?

  • @matt92hun
    @matt92hun Рік тому

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

  • @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.

  • @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.

  • @HelmutFischer-thehefi
    @HelmutFischer-thehefi Рік тому +1

    Very helpful! Thx!

  • @cesar1087
    @cesar1087 Рік тому

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

  • @PrabhuKumar-er5fo
    @PrabhuKumar-er5fo Рік тому

    Is there any fork with fzf with vim simple navigation

  • @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.

  • @felipemachado4323
    @felipemachado4323 Рік тому

    How do you do to get command suggestions on terminal?

  • @muddyexport5639
    @muddyexport5639 Рік тому

    Cool vid. Thanks!

  • @5ebastiancarlo5
    @5ebastiancarlo5 Рік тому

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

  • @JoettaPatch-b8t
    @JoettaPatch-b8t Місяць тому

    Precious Bridge

  • @MelissaHall-k8r
    @MelissaHall-k8r Місяць тому

    Vernice Trail

  • @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.

  • @postmaster-p
    @postmaster-p Рік тому +2

    CP3🙌

  • @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.

  • @heroe1486
    @heroe1486 Рік тому

    nice video thanks

  • @sebaszwarc
    @sebaszwarc Рік тому

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

  • @valentynmudryk2869
    @valentynmudryk2869 Рік тому

    I can't use two fzf in one command

  • @AsiaDavirro-m4y
    @AsiaDavirro-m4y Місяць тому

    Ashton Radial

  • @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

  • @HughBrandon-s5v
    @HughBrandon-s5v Місяць тому

    Ricardo Extension

  • @DuncanDarren-c4z
    @DuncanDarren-c4z Місяць тому

    Johnston Crest

  • @GeorgiannaToce-w8x
    @GeorgiannaToce-w8x Місяць тому

    Blanda Circles

  • @ChristyGale-l8c
    @ChristyGale-l8c Місяць тому

    Clifton Mill

  • @PatriciaPuskas-l4s
    @PatriciaPuskas-l4s Місяць тому

    King Knoll

  • @AndreiRobertYTlolYes
    @AndreiRobertYTlolYes Рік тому +2

    Hey new Linux Trisquel 11.0 2023

  • @Mary-Gonzalez-b9j
    @Mary-Gonzalez-b9j 29 днів тому

    Purdy Fork

  • @MorrisValentine-t9r
    @MorrisValentine-t9r Місяць тому

    1663 Minnie Ridges

  • @DunlopJanet
    @DunlopJanet Місяць тому

    5140 Murazik Islands

  • @CoffeyBonnie-m2f
    @CoffeyBonnie-m2f Місяць тому

    Shawn Lake

  • @DelilahMielczarek-k7j
    @DelilahMielczarek-k7j 2 місяці тому

    Roberts Circle

  • @DanicaCourtois-m5j
    @DanicaCourtois-m5j Місяць тому

    Mayer Skyway

  • @CromwellAlfred
    @CromwellAlfred Місяць тому

    305 Parker Track

  • @ElArboool
    @ElArboool Рік тому

    Zed*

  • @ZimmermanLeo
    @ZimmermanLeo Місяць тому

    238 Carrie Circle

  • @DonovanInocencio-u3i
    @DonovanInocencio-u3i Місяць тому

    Lesch Loop

  • @SheraRoundtree-u4j
    @SheraRoundtree-u4j Місяць тому

    Taylor Brenda Lewis Joseph Taylor Sandra

  • @PriceNelly-c1p
    @PriceNelly-c1p 2 місяці тому

    Botsford Union

  • @MerkDolf
    @MerkDolf Рік тому

    Ah,

  • @sbr895
    @sbr895 Рік тому +1

    First.

    • @lqlarry
      @lqlarry Рік тому +1

      I missed it by that much.

  • @fabricio4794
    @fabricio4794 Рік тому

    I Hate Command Lines

  • @JosePerez-y8h
    @JosePerez-y8h Місяць тому

    8110 Harris Passage

  • @WollastonViolet
    @WollastonViolet Місяць тому

    51919 Kyler Coves

  • @EvansTab
    @EvansTab Місяць тому

    22997 Lester Freeway