You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Just the other day, a good friend shared this tool called broot and I always know something cool is up when he shares these kinds of things. So I decided to check it out and as I had anticipated, my jaw dropped. Have you heard of broot? If you have then I hope you are enjoying every minute as you use it and you haven’t, kindly pay keen attention because this fantastic tool is about to make your terminal life a sci-fi experience and we are not kidding.

Hoping to have baited your attention, broot is a brilliant and next-gen tool that you can harness to completely change how you navigate your directory trees while in your favorite Linux terminal (using bash, zsh or fish). After you make your aquaintance with broot, there is a high chance you will forget about ls for good because, trust me, broot does a better job.

Beautiful Features of broot

Get an overview of a directory, even a big one

All you have to do is key in br in the directory you are currently in and you should get tree-like structure of directories and sub-directories within it. Instructions on how to navigate are clearly and neatly presented at the bottom for you.

br

Find a directory then cd to it

What is fun about broot is that you can search for the directory you would wish to work with at that moment. Simply type the name of the directory within the directory you are currently in and broot will gladly present what it matches it with. And guess what, it does not care about the case (Upper or lower) as you type. Once you have found the directory you would wish to enter into, simply press (alt + enter) and it is equivalent to cd into the folder.

Most useful keys for this:

  • the letters of what you’re looking for
  • enter to select a directory (staying in broot)
  • esc to get back to the previous state or clear your search
  • (alt + enter) to get back to the shell having cd to the selected directory
  • :q if you just want to quit (you can use ctrl + q if you prefer)

Manipulate your files

Most often you move your files in the blind. You do a few ls before, then your manipulation, and maybe you check after. You can instead do it without losing the view of the file hierarchy. Move, copy, rm, mkdir, are built in and you can add your own shortcuts. If for example you would wish to copy a file, you highlight the file then begin typing your command after you place full colon It will automatically choose the file you highlighted as the source so you simply have to key in the directory path you want to copy to and it keeps a track of it for you as you type. Check the illustration below.

Do it with panels

broot ain’t no joke. If you prefer having panels, you better have broot installed already. You can open another panel for a directory quite easily. Highlight the directory then press (ctrl + →) keyboard keys and you have it on the right side. After that you can move from right to left by (ctrl + ←) and left to right by (ctrl + →). Pretty intuitive, right?

Nevertheless, using two panels, you can for example copy or move elements between them:
Using my example, if you would wish to copy App.vue to assets directory on the right, first I have to ensure I highlight the assets directory or just be on a file within it, then I navigate to the left panel by (ctrl + ←) and I can simply type out “App” which will select the “App.vue” file then follow with cpp command which means “copy to panel” then press enter.

Check space of files and directories

The versatility of broot goes on and on. With it, you can view what is taking space in your directory trees. To do this, you can either start broot (br) using –sizes option or if you are already within br simply type full colon then s (:s) and press enter.

br --sizes

You can alternatively use :s and press enter. It will produce results similar to above

You can check git statuses as well

Are you worried that your files will not have git status? Worry no more. 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. And if you want to see only the files which would be displayed by the git status command, do :gs

Results of the command above is shown below

Installation

Hoping you have been totally convinced to use broot, you can get this brilliantly thought out and expertly developed tool by following the steps below depending on what you prefer.

From precompiled binaries

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

Using Homebrew

If you’re using homebrew, you can use the brew install command:

brew install broot

note: the brew formula is maintained by a third party and may be less up to date.

From source/git

You’ll need to have the Rust development environment installed.
Fetch the Canop/broot repository, move to the broot directory, then run

git clone https://github.com/Canop/broot.git
cargo install --path .

When you start broot, it checks whether the br shell function seems to have been installed (or to have been refused). If needed, and if the used shell seems compatible (supported shells today are bash, zsh and fish), then broot asks the permission to register this shell function

broot

Broot should be launched using a shell function (see https://github.com/Canop/broot for explanations).
Can I install it now? [Y n]
y
Writing br shell function in /home/tech/.local/share/broot/launcher/bash/1.
Creating link from /home/tech/.config/broot/launcher/bash/br to /home/tech/.local/share/broot/launcher/bash/1.
/home/tech/.bashrc successfully patched, you can make the function immediately available with
source /home/tech/.bashrc
/home/tech/.zshrc successfully patched, you can make the function immediately available with
source /home/tech/.zshrc

The br function has been installed.
You may have to restart your shell or source your shell init files.
Afterwards, you should start broot with br in order to use its full power

You now have broot installed. Restart your terminal and to start off the magic, type br on your terminal and let the fun soar.

br

Denouement

There is nothing more I can add to the fact that broot is awesome. We encourage you to have a taste of it in your own terminal. Otherwise, we appreciate your relentless support and thank you for reading through.

Reference: Broot Git Page
Reference: Broot Website

Similar guides:

Linux & FreeBSD Resource Monitoring with bpytop

Install Bashtop – Terminal Resource Monitor for Linux | macOS | FreeBSD

Install Tilix GTK3 tiling terminal emulator on Ubuntu / Debian

10 Best Terminal Emulators for Linux

How To Share your Linux Terminal Session in Web Browser

Linux Learning Videos:

$11.92
$154.97
in stock
Udemy.com
$11.92
$154.97
in stock
Udemy.com
$11.92
$154.97
in stock
Udemy.com
(12839)
$11.92
$154.97
in stock
Udemy.com
You can support us by downloading this article as PDF from the Link below. Download the guide as PDF