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

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

Interview 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 improved, 50 years since the invention of Unix.

Séguret found that was not the case, particularly when it came to navigating source code that can have thousands of files in a single project. “I deal with many many projects, more than what my brain can memorise. So I always have to look a little to know how a project works,” he told The Register.

“I was doing this with ls, and regretting that tree doesn't really work when there are many files. So I had the idea to trim the tree so that I can get an overview. Most other ideas were quite natural from there.”

On Unix-like operating systems, the ls command lists files while tree provides a listing of all files including those in subfolders, which are often so numerous that what you want to see scrolls rapidly out of view.

By default, Broot does not list all files, but shows an overview, with notes like “50 unlisted.” Better still, if you type a few letters, it will show all matching files and directories, even if the letters are not consecutive. You can then easily select a directory and list all its files. You can also use regular expressions, a powerful means of pattern matching though arcane for the uninitiated.

Broot works on Linux, Mac and Windows 10, though the docs say that: “While the Linux version is quite well tested, the other versions are lacking testers and involved developers.”

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. This is of great value when drives fill up, not uncommon with SSDs typically being less capacious than spinning metal. On Windows there is always TreeSize Free, but a command-line alternative is welcome.

While we successfully ran Broot on Windows, it is slower than on Linux and some features did not work. That said, it was still many times faster than Search in Windows File Explorer for finding a file in a deeply nested folder.

The utility has some other nice features, including an option to respect gitignore files, which determine which files are covered by git source control. There are options to show hidden files, file permissions and file date and time. You can also define shortcuts for commands you use often, including one or more arguments. Commands for moving files and creating or removing directories are built-in. You can execute applications or editors. You can also customise the colouring by using a configuration file.

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.

Why the name? “At the beginning it was b-root,” said Séguret, “which is a reference to b-tree, balancing tree, as the basic idea is to dive into all branches in parallel, and also taking into account that what we call trees look more like root systems (i.e. going towards the bottom). And broot sounds like "broute", which means graze in French, hence the cow as a logo.”

The utility has been the subject of generally favourable discussion on HackerNews. One commenter said, “I don’t care if its been done before … broot just WORKS! and it works well, I finally got rid of all the aliases around ls that I used in order to get info I want.” Another said, “This has replaced nnn for me and solves so many devops headaches.” The nnn utility is another lightweight file manager.

Broot is currently at version 0.11.3; the code is on GitHub. How close is version 1.0? “I was expecting to do it about next week. But due to the HackerNews exposure (the tool was discussed this morning on techie message board institution HackerNews), I've received today a lot of issues and suggestions, and some fixes (for mac or zsh) seem to be necessary.”

That said, “it looks like there's nothing big preventing the 1.0,” Séguret told us. After that, he has "a few ideas for broot, some of them quite big," he said, but would not be drawn on specifics.

What about Windows? “I'm not sure for Windows. I'm not even sure it really fits the culture. I mean: if people don't use the console at all, there's no point in such an application,” said Séguret. He may be surprised by the level of interest, with terminal usage growing on Microsoft’s platform. ®

Similar topics

Other stories you might like

  • Amazon warehouse staff granted second chance to vote for unionization

    US labor watchdog tosses previous failed result in the trash

    America's labor watchdog has given workers at Amazon’s warehouse in Bessemer, Alabama, another crack at voting for unionization after their first attempt failed earlier this year.

    “It is ordered that the election that commenced on February 8 is set aside, and a new election shall be conducted,” Lisa Henderson, regional director at the National Labor Relations Board, ruled [PDF] on Tuesday.

    “The National Labor Relations Board will conduct a second secret ballot election among the unit employees. Employees will vote whether they wish to be represented for purposes of collective bargaining by the Retail, Wholesale and Department Store Union.”

    Continue reading
  • It's the flu season – FluBot, that is: Surge of info-stealing Android malware detected

    And a bunch of bank-account-raiding trojans also identified

    FluBot, a family of Android malware, is circulating again via SMS messaging, according to authorities in Finland.

    The Nordic country's National Cyber Security Center (NCSC-FI) lately warned that scam messages written in Finnish are being sent in the hope that recipients will click the included link to a website that requests permission to install an application that's malicious.

    "The messages are written in Finnish," the NCSC-FI explained. "They are written without Scandinavian letters (å, ä and ö) and include, for example, the characters +, /, &, % and @ in illogical places in the text to make it more difficult for telecommunications operators to filter the messages. The theme of the text may be that the recipient has received a voicemail message or a message from their mobile operator."

    Continue reading
  • AsmREPL: Wing your way through x86-64 assembly language

    Assemblers unite

    Ruby developer and internet japester Aaron Patterson has published a REPL for 64-bit x86 assembly language, enabling interactive coding in the lowest-level language of all.

    REPL stands for "read-evaluate-print loop", and REPLs were first seen in Lisp development environments such as Lisp Machines. They allow incremental development: programmers can write code on the fly, entering expressions or blocks of code, having them evaluated – executed – immediately, and the results printed out. This was viable because of the way Lisp blurred the lines between interpreted and compiled languages; these days, they're a standard feature of most scripting languages.

    Patterson has previously offered ground-breaking developer productivity enhancements such as an analogue terminal bell and performance-enhancing firmware for the Stack Overflow keyboard. This only has Ctrl, C, and V keys for extra-easy copy-pasting, but Patterson's firmware removes the tedious need to hold control.

    Continue reading

Biting the hand that feeds IT © 1998–2021