Jump to content

Excellent Utilities: broot – next gen tree explorer and customizable launcher


aum

Recommended Posts

This is a series highlighting best-of-breed utilities. We cover a wide range of utilities including tools that boost your productivity, help you manage your workflow, and lots more besides.

 

The Command Line Interface (CLI) is a way of interacting with your computer. To harness all the power of Linux, it’s highly recommended mastering the interface. It’s true the CLI is often perceived as a barrier for users migrating to Linux, particularly if they’re grown up using GUI software exclusively. While Linux rarely forces anyone to use the CLI, some tasks are better suited to this method of interaction, offering inducements like superior scripting opportunities, remote access, and being far more frugal with a computer’s resources.

 

The part of the operating system responsible for managing files and directories is called the file system. It organizes our data into files, which hold information, and directories (also called ‘folders’), which hold files or other directories.

 

One of the commands that help visualize your file system is tree, a command that list contents of directories in a tree-like format. One of the issues with tree is that the output is unwieldy with large directories. Step forward broot, a utility that gives an overview of a directory, and much much more.

 

Installation


There’s lots of ways of installing broot.

 

Unless you’re a Rust developer, we recommend that you don’t install the Rust development environment. Instead, we recommend installing a precompiled binary.

 

We downloaded the precompiled binary for Linux. Move the binary to /usr/local/bin and make it executable with the commands:

 

$ wget https://dystroy.org/broot/download/x86_64-linux/broot
$ mv broot /usr/local/bin
$ chmod u+x broot

 

We also tested broot using a vanilla Ubuntu 21.04 installation. cargo and build-essential packages aren’t installed by default. Rectify that with the command:

 

$ sudo apt install cargo build-essential

 

Next we install broot using cargo.

 

$ cargo install broot

 

One further step is that you’ll need to ensure ~/.cargo/bin is in your PATH. The variable $PATH is set by your shell every time it launches, but you can set it so that it always includes your new path with every new shell you open. The exact way to do this depends on which shell you’re running.

 

For the bash shell we follow these steps:

 

Open the .bashrc file in our home directory (~/.bashrc) in a text editor.


Add export PATH=”~/.cargo/bin:$PATH” to the last line of the file.


Save the .bashrc file.


Restart the terminal (or run the command source .bashrc).

 

In Operation


If you’ve used the tree command you’ll encounter the problem that it produces page after page of output. Of course you can pipe its output to more or less.

 

But there’s a better way of viewing and navigating large directories.

 

Here’s an image of broot in action. Instructions on how to navigate are set out in the bottom bar.

 

broot-navigate.png?resize=700,580&ssl=1

 

 

What does broot offer?

 

  • Provides a concise overview of a large directory.
  • Find a directory by typing a few letters and hit alt and enter to navigate to the desired location. This provides a very efficient and fast way to navigate to a directory.
  • Selects the most relevant file and helps you keep track of file hierarchy when searching.
  • Run common file operations like ls, cp, mv, mkdir without losing the view of the file hierarchy.
  • Open additional panels and perform file operations between elements in each panel. The software can display two panels which are useful for previewing files and copying/moving files between two locations, but you can add more panels if your terminal is wide enough.
  • Preview files such as images without losing track of the file hierarchy. Search with fuzzy patterns or regular expressions inside a text preview panel.
  • Apply a standard or personal command to a file. And apply commands to several files.
  • Clipboard functionality.
  • Disk usage functionality using the --sort-by-size flag.
  • Check git statuses. Use :gf to display the statuses of files (what are the new ones, the modified ones, etc.), the current branch name and the change statistics.
  • Tons of other flags and options as shown in the image below. Flags and options can be classically passed on launch but also written in the program’s configuration file.

 

broot-options.png?resize=700,1150&ssl=1

 

 

Summary


broot lets you explore file hierarchies with a tree-like view, manipulate files, launch actions, and define your own shortcuts.

 

This utility is a real boon to productivity. It’s a great utility combining a configurable tree-like view, file manager and launcher.

 

broot is a worthy addition to our Excellent Utilities feature. That’s high praise indeed!

 

Website: dystroy.org/broot
Support: GitHub Code Repository
Developer: Denys Séguret and contributors
License: MIT License

 

broot is written in Rust. Learn Rust with our recommended free books and free tutorials.

 

It has been awarded around 6k GitHub stars.

 

Source

Link to comment
Share on other sites


  • Views 927
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...