back to article I am broot: The Reg chats to French dev about Rust tool that aims to improve directory navigation

Rust developer Denys Séguret, from Lyon, France, wanted a better way to view and search directories, so he coded his own, sparking interest from others with similar frustrations. Broot is a command-line utility for listing and manipulating files and directories – basic functionality that you would have thought could hardly be …

  1. _LC_
    Unhappy

    Stopped reading at "command line tool" ...

    Problems of the past. Let them be buried there for good.

    1. paulll

      Re: Stopped reading at "command line tool" ...

      "Problems of the past." How d'you figure?

      1. _LC_

        Re: Stopped reading at "command line tool" ...

        See my post below about "Directory Opus" (which came out in 1990 on the Amiga).

    2. Joe W Silver badge

      Re: Stopped reading at "command line tool" ...

      Yeah, right. Just had to write a script to generate a bunch of local users on a Windows[*] machine, together with passwords generated by a certain rule. Good luck doing that as a mouse jockey.

      [*] work. Only run different flavours of Linux at home. Really grateful for my boss, who used to be a real Windows Sysadmin - he has tons of scripts to do this type of things.

      1. _LC_

        Re: Stopped reading at "command line tool" ...

        And in which way does an "interactive", semi-graphical command-line tool help you in writing your scripts, opposed to - say - a true graphical one?

        1. Peter X

          Re: Stopped reading at "command line tool" ...

          And in which way does an "interactive", semi-graphical command-line tool help you in writing your scripts, opposed to - say - a true graphical one?

          Hands are on keyboard.

          It's not that a graphical interface is wrong, it's just that graphical interfaces have a tendency to add a tool bar and demand mouse interaction, which is good because of discoverability, but bad because it's much slower than just pressing keys (muscle memory works with the latter but not the former)... and yeah, you have keyboard shortcuts in GUI apps, but often, they're a bit of an after-thought.

          But honestly, just use what you like! Command line things are often not so great if you only use them very occasionally because then the lack of discoverability is very much a negative.

          Me, I like command line for certain tasks, such as file-management because they're fast, and I can use them over SSH. Plus, startup time... command line stuff is usually pretty instant. Starting even a light-weight GUI app typically takes at least the best part of a second, which is annoying slow when you're in flow.

          1. phuzz Silver badge

            Re: Stopped reading at "command line tool" ...

            "muscle memory works with the latter but not the former"

            My muscle memory works just fine with a gui. In fact, given the various strengths (spacial and layout) and drawbacks (memorising strings) of my memory in general, I'd say I works best with a gui.

            1. Peter X

              Re: Stopped reading at "command line tool" ...

              When I say muscle memory, I'm talking about the ability to (in this case) press a key or combination of keys, without even having to engage the conscious mind. If you need to use a mouse to click on something, it may certainly be something you don't think about, but you *do* focus your mind simply be virtue of *having* to look where the mouse pointer is to click on something.

              Things like walking, running or riding a bicycle are things that end up in muscle memory. GUIs certainly get easier once you are familiar with them, but I'm pretty certain that isn't quite muscle memory.

              But... it's possible your (and other peoples) minds are wired different to mine.

    3. Androgynous Cupboard Silver badge

      Re: Stopped reading at "command line tool" ...

      ... must... not... respond... to .... obvious... troll...

    4. Anonymous Coward
      Anonymous Coward

      Re: Stopped reading at "command line tool" ...

      Yes, from the 1980s people started to think GUIs and IDEs were a good thing to manage large projects, but then Linux opened the door to all the loonies who believe you are a true computer user only if you use the command line only and type arcane commands.... and the strange idea you have to suffer to get anything done or it's not a good way - which is strangely akin to what religions do and say.

      Really, that was a problem I had with DOS 3.1 before I bought Norton Commander... someone is still almost fifty years late.

      1. jake Silver badge

        Re: Stopped reading at "command line tool" ...

        If you don't use the command line, you have been missing out on a good portion of nc's inherent power. Kinda makes me wonder if you know what you are talking about in other areas.

        Note that nc is now mc, AKA Midnight Commander.

        1. Michael Wojcik Silver badge

          Re: Stopped reading at "command line tool" ...

          Personally, I never warmed to NC, or mc, or tree, or ISPF member listings, or OS/400's WRKF, or any of those other full-screen filesystem navigators. Or to their GUI equivalents. ls and find, on their own or as part of a pipeline, have always seemed more straightforward to me.

          But to each their own, at least as far as incidental use goes. For system-administration tasks that need to be audited or repeatable, I think anything other than a script (in whatever language) is pretty daft.

    5. baud

      Re: Stopped reading at "command line tool" ...

      On the development side of things, at least command line tools offer the benefit of avoiding to design a graphical interface, with all the bikeshedding that comes with it.

      And it's easier to repeat a basic task with command line tools than with a GUI

    6. dozen

      Re: Stopped reading at "command line tool" ...

      > The nnn utility is another lightweight file manager.

      Did you try nnn which the article mentions?

      Brings perfect balance between the CLI and GUI.

      1. Michael Wojcik Silver badge

        Re: Stopped reading at "command line tool" ...

        For me, "perfect balance" is 100% CLI.

        1. dozen

          Re: Stopped reading at "command line tool" ...

          And nnn goes 100% CLI with a single environment variable!

  2. Anonymous Coward
    Anonymous Coward

    Really?

    That is a shame, since Broot can do something the Windows File Explorer cannot, which is to show how much space is occupied by a directory including all its sub-directories.

    How about right click, Properties? That gives you the total logical and physical sizes of all files plus a count of files and subfolders. Well, at least on Windows 7 it does...

    1. _LC_
      Mushroom

      Re: Really?

      Even more so - there are extensions, which do this if you wish. They even come with options to exclude slow (network) devices and whatnot. One such tool is called "Directory Opus" (https://www.gpsoft.com.au). This software came from the Commodore Amiga, which tells us how old the solution to his problem is ...

      1. NetBlackOps

        Re: Really?

        Yep. Current fave is XYplorer which does well even in the face of millions of files on multi-terabyte arrays. Everything for finding things, set to list in directory order. That combination works on the graphical end. Naturally, I'll be looking at broot for console. Pattern matching. Yum.

      2. AIBailey
        Pint

        Directory Opus

        This is probably the most useful tool on the Amiga once you have a HDD (and even for floppy disk file management).

        I still have it on my real and virtual Amiga's, though I never got on with version 5, which was almost a replacement for Workbench, and hence stick with version 4.something.

        For the creators of all versions of Directory Opus -->

        1. Anonymous Coward
          Anonymous Coward

          Re: Directory Opus

          Wasn't Directory Opus a clone of the freeware file manager Sid?

    2. Sitaram Chamarty

      Re: Really?

      that's one at a time. Seeing them all, with sizes listed, sorted descending by size, and navigable, is amazing.

      Pretty much what ncdu, qdirstat (GUI) or similar tools do, of course, but Windows Explorer does NOT have that natively.

    3. richardcox13

      Re: Really?

      How about right click, Properties? That gives you the total logical and physical sizes of all files plus a count of files and subfolders

      But will overcount when symbolic and hard links are present. (Which NTFS does support and Windows makes heavy use of in places.)

      Whether Broot takes these into account I have no idea, but given a Linux background I would hope so...

    4. AIBailey

      Re: Really?

      How about right click, Properties?

      That works if you want to see how much space a given folder is taking up, but if you want to know, at a glance, which of the 50 folders in your directory holds the most data then you'll need a pen, paper and patience.

      Hence the reference to TreeSize Free, which is an incredibly useful tool.

      1. FIA Silver badge

        Re: Really?

        Hence the reference to TreeSize Free, which is an incredibly useful tool.

        [cough] WinDirStat. [/cough] :)

        1. phuzz Silver badge

          Re: Really?

          Or Spacemonger if you prefer.

  3. HeIsNoOne

    "Broot can do something the Windows File Explorer cannot, which is to show how much space is occupied by a directory including all its sub-directories."

    Windows file explorer does offer this feature - right-click->Properties.

    1. yoganmahew

      Yep and then repeat for all 900 directories off the main directory to find the errant large log file.

      1. Anonymous Coward
        Anonymous Coward

        I'm suddenly reminded of the first threaded program I wrote. It walked a filesystem finding large files, something that I couldn't find a way to parallelise with find(1) and a shell script. It was called "chubbychaser" which amused my colleagues.

    2. Joe W Silver badge

      But not recursively...

    3. _LC_

      As he's writing it for Linux ...

      ... you might also want to take a look at "K4DirStat".

  4. karlkarl Silver badge

    I just use

    $ find src

    And get a recursive listing of the entire folder. Great!

    Too many files? Then if you do:

    $ find src | less

    You can use arrow keys and page down. Then in the pager (less), just use '/' to search for specific files.

    It honestly is very easy. You get a much better overview than even a GUI file manager.

    1. cbars Bronze badge

      You do understand the word arcane, right? It's easy when you know how...

      I prefer command line purely because its repeatable and I can save a command to do exactly what I want, vs. mind numbing repetition.

      Still a crap solution for those who have typical jobs/purposes

      Just sounds a lot like people arguing in favour of their paper based filing systems - sure *you* can find the file quickly in *your* filing cabinet - what about the rest of us?

      1. FIA Silver badge

        You do understand the word arcane, right? It's easy when you know how...

        Why is having to learn such a bad thing these days? Many of the GUIs in the 90s fell into that category too, you learnts how to use them then transferred the skills between apps. (eg, learning that the middle button woukld bring up a context menu for example).

        Still a crap solution for those who have typical jobs/purposes

        If your job requires you to do a 'thing' then learn to use the tools to do that 'thing'. I want some building work done I hire a builder, they know how to use all the oh so fun but dangerous building tools that I'd merely make a mess with. Computers are complex and sometimes require a bit of knowlage. (ie, if you learn about 'man' you can usually figure out most commands on a BSD...) We tried working with the assumption that everything is easy in the 90s which resulted in Wizzard hell. Great the first time, but those 94 screens to set things up are sure annoying the 1000th time through.

        Most people would be better served learning that it's okay not to be able to do something the first time and having to learn isn't a bad thing or something that stops after childhood.

        1. cbars Bronze badge

          Yes, learning should be encouraged... but I dont think we should encourage everyone to learn what you know, or what OP knows. This article is about a better tool. If you hire a builder a hes using medieval wood scaffold instead a rig/crane/modern scaffold.... yea its bad, there is a better way

          Usually once people know one way of achieving a goal they are not interested in a better way. So rather than sharing arcane knowledge and lamenting "these days", take an objective look and decide for yourself, but I dont think 3 commands piped together beats one for any standalone goal ( "thing" ), even if it is easy to do after acquiring the knowledge. You've got to read 3 man pages instead one. Better tools should be desirable, lots of damage is being caused by unsafe practices which are not helped by people following their traditions instead of learning a better way.

          So, in short, you may object to my flippant tone but you've failed to convince me that the original poster had a valid complaint.

      2. phuzz Silver badge

        "I can save a command to do exactly what I want, vs. mind numbing repetition"

        That's the main distinction for me between a CLI and a GUI. If you have to do the same (or very similar) thing over and over again, CLI (and scripting) is usually easiest.

        If you're doing different jobs each day, the discoverability of a GUI will help.

        Personally very little of my job could be scripted.

        1. cbars Bronze badge

          Because you've already scripted every bit that can? Same ;)

  5. Anonymous Coward
    Anonymous Coward

    Surely the solution is the data structure no?

    Who created this abomination based on a tree. Why not remove the filesystem and the horrible path, which isn't part of the object (unlike its name), and yet is integral to locating and manipulating the object? Someone should take a chainsaw to it.

    1. Anonymous Coward
      Anonymous Coward

      Re: Surely the solution is the data structure no?

      Ah yes, the object filesystem - that worked so well for Oracle.

      1. Anonymous Coward
        Anonymous Coward

        Re: Surely the solution is the data structure no?

        For a minute there I thought you were talking about one of Larry's yachts. No that was a complete disaster because it tried to add a POSIX interface. You know the usual tree operations, graft lop, uproot, trim etc. It had no chance in the forest of file Operating Systems.

  6. Anonymous Coward
    Unhappy

    LDAP

    Am I the only one who immediately thought 'ldap' when reading about better directory search?

  7. Anonymous Coward
    Anonymous Coward

    Command line tool to show directory usage

    There is a Windows command line tool to do this:

    https://docs.microsoft.com/en-us/sysinternals/downloads/du

  8. Anonymous Coward
    Anonymous Coward

    I know I'm going to sound like a grumpy old man

    But it bothers me how few people nowadays are trying to build tools to do system administration tasks, but then their eyes gloss over when you mention xargs.

    But, also, if you have to use special tools to look at your source code, then either your project is a badly planned flaming pile of shit, or you are trying to just do far too much. I do a lot of kernel development work and I've never had a problem moving around it. And sure, that's largely because I only work in precious few spots, but I don't know of anyone who has the skills to intelligently touch more than a small section anyway, I wouldn't even trust Linus touching a lot of the kernel's code, he's brilliant, but he isn't an expert in everything (And if he is touching a lot of stuff, its going to be stuff that can be automated with doing a find / xargs line and he's smart enough to just mark problems rather than trying to fix them all himself). I've found that people that make sweeping changes across a large project tend to be incompetent idiots that think they know better, but just leave giant messes in their wake.

    I am also extremely leery about developers that try and work on a thousand different projects at once. Quality programming involves swapping a lot of state in and out of your mind, which takes time and effort. Time and effort that could normally be used to actually code. That is, unless the code is just so trivial that you can just bash away without thinking...

    1. jake Silver badge

      Re: I know I'm going to sound like a grumpy old man

      And if you mix curses in with xargs and miscellaneous other scripting, you've got something even most GUI fans can figure out how to use, sans the overhead of a GUI.

  9. jake Silver badge

    As an old UNIX hacker, strangely enough ...

    ... I'm rather fond of one of the few useful tools that have been ported from DOS to the un*x world. That would be Midnight Commander (or mc, home page), which is a Norton Commander clone. It handles probably 98% of all my file management needs. Give it a try if you're unfamiliar with it. Something that has been around for over a third of a century must be doing something right ...

    1. don't you hate it when you lose your account

      Re: As an old UNIX hacker, strangely enough ...

      Just about the first thing to be installed on every system I spin up after the first upgrade + update. Will give this a look, but mc has been my goto since (happily) long ago forgoton dos days

    2. Philip Storry

      Re: As an old UNIX hacker, strangely enough ...

      Second this. Midnight Commander is incredibly useful, and seems to have crept on to all my Linux systems somehow...

      When I was using DOS, I preferred XTree Gold - but have grown to prefer Midnight Commander over the various XTree clones that *NIX has seen over the years.

      I'm not sure why, other than the two pane paradigm is incredibly useful...

  10. richardcox13
    Boffin

    What do you mean "ho ho"?

    Broot is coded in Rust, of which Séguret remarks, “There's this thing quite new in Rust: when you make your code compile, it works and usually does what you wanted it to do.” Ho ho.

    This is quite common in languages with a very strong type system (not the limited type systems of C, .NET and the JVM). Once it compiles, it just works. It does mean embracing the type system for maximum effect which is definitely a move away from languages like JavaScript.

    1. Tom 7

      Re: What do you mean "ho ho"?

      It is possible to extend JavaScript to include strong typing.

      JavaScript suffers from where it is in the eco-system and any language that is easy to use in the browser will suffer the same problems. I've seen lots of people writing why strong typing should not be added to JavaScript but none that really stand up to the problems not having it causes in the wild.

  11. Tom 7

    "Why Rust? 'It works and usually does what you wanted it to do,' says dev"

    or:

    "Because my programming skills improved to do what I wanted to do here and it just happened to be in Rust."

    Sometimes its just reading the documentation and actually understanding it.

  12. p00b

    "Why the name? “ And broot sounds like "broute", which means graze in French, hence the cow as a logo.”"

    Well, broot, pronounced "beeroute" means penis in French (biroute)...

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like