Install and Use the broot Command
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
broot command provides a modern approach to generating directory trees on the Linux command line. It renders the tree in a succinct and intuitive layout that helps you navigate around your computer’s directories. Additionally,
broot offers advanced features for managing and retrieving details about your files and directories. This guide shows you how to install
broot on your Linux system and get started using it.
Follow our Setting Up and Securing a Compute Instance guide to update your system. You may also wish to set the timezone, configure your hostname, create a limited user account, and harden SSH access.
sudo. If you’re not familiar with the
sudocommand, see the Linux Users and Groups guide.
broot tool gives you a convenient and capable directory tree. It specializes in making directories easy to navigate and to get its overview — even when the directory is massive and complex.
broot accomplishes this with features like abbreviated subdirectory contents and an advanced file search that does not lose your place in the tree.
broot command-line tool also brings a lineup of file management features you can use right from the displayed directory tree. In this way,
broot is much more than a tool for reviewing directory contents. For instance,
broot lets you copy and move files between side-by-side panels and preview file contents.
brootbinary for your system from the
If you are using Debian, Ubuntu, or Fedora, use the link for x86_64-linux.
If you are using AlmaLinux or CentOS, use the link for x86_64-unknown-linux-musl.
Once you have your download link, use cURL to download the
brootbinary. Replace the URL in the command below with the appropriate one for your operating system.
curl -o broot -L https://dystroy.org/broot/download/x86_64-linux/broot
brootbinary to the
/usr/local/bindirectory, and give the file execute permission:
sudo mv broot /usr/local/bin sudo chmod +x /usr/local/bin/broot
brootwith the following command:
You are prompted to install the
brootshell function. Choose Yes (Y) to continue.
Restart your shell session by exiting and logging back in, or source your
You can start
broot with the
br command. You can also provide a path to a directory you want to start
The examples in this section runs
broot in a cloned Git repository. This makes it easier to demonstrate how
broot integrates with Git. You can get clone the repository used in this guide by running the following commands in your user’s home directory. Replace
yum on AlmaLinux and CentOS or with
dnf on Fedora:
sudo apt install git git clone https://github.com/google/docsy-example.git
Now, you can open
broot in that repository’s directory with the following command:
Here are some useful commands for exploring the file tree once you are in
brootfile tree with the up and down arrows. Press Enter on a given directory to make it the new root of your directory tree. Pressing Enter on the current root (at the top of the tree) moves the tree’s root up a directory.
You can search the directory tree by typing at any point.
brootdynamically updates the tree to show the matching files and directories as you type. Pressing Esc resets the search form.
brootalso comes with some more advanced search options. Among them, you can do a “fuzzy” search on file names by typing
f/followed by the text to search for. You can also do a full regular expression (regex) search by typing
/followed by your regex.
cdyou into a directory. Select the directory, then press Alt + Enter.
brootchanges your shell’s current working directory and exits you back into the shell.
Use the combination of Ctrl and the right arrow key to open a separate panel for the selected file or directory.
If you used the combination on a file, the new panel previews the file’s contents, even if it is an image file. You can use the combination again to focus on the file contents. Once focused on the file contents, you can navigate them with the up and down arrow keys:
If you used the combination on a directory, the new panel displays a directory tree with the selected directory as the root:
Use the Ctrl and left arrow key combination to shift focus back to the original panel, if the focus was on the new panel. Then, use the combination again to close the new panel.
broot, in addition to using assigned keyboard keys, has a dedicated command system. Typing a space or colon while the search field is blank starts a command entry, similar to the system in the Vi text editor. Pressing Enter then executes the command.
One of the most useful commands available is the
exit command. Typing
:q and pressing Enter exits
broot, putting you back in the shell in the same working directory where you started.
You can get a full list of commands for
broot by typing ? when the search/command form is empty.
The sections below also highlights useful commands to help you get started managing files and directories using
broot has numerous options to display more information about files and directories. You have access to everything from Git annotations to the level of detail provided in the
ls -al command.
:sizescommand to have
brootlist usage information alongside files and directories.
When you are in a directory for a Git repository, the
:gfcommand shows Git annotations, allowing you to quickly assess what files have changed.
You can also isolate the modified files in a Git repository using the
Similar to the shell’s
brootis capable of displaying details about files and directories. Below is an example with results similar to the
:datescommand to show last modified dates, then the
:permcommand to show permissions information. Finally, use
:hto show hidden files. The result resembles the image below:
The file management capabilities of
broot set it apart from other Linux utilities.
broot offers a set of file-management option along with an easy-to-read tree. Below are some examples that cover basic file-management needs.
Press Enter on a file to have
brootattempt to call a program to open the file. You can also use the
:ecommand to have
brootattempt to open the file with the default editor program.
$EDITORenvironmental variable to determine what editor to use. If you do not have this variable set, you can set it with a shell command like the one below. The below example command sets the default editor to Vim.
export EDITOR=$(which vim)
You can add the above command to your
~/.bashrcfile to make the setting persistent.
Copy a file or directory using the
:cpcommand followed by the location to copy to (relative to the location of the file/directory being copied).
Move files and directories using the
:mvcommand followed by the location to move to.
broothas a more convenient method for copying and moving files if you are using panels.
Open a panel for the directory you either want to copy/move an item into or out of the directory. Select the file or directory you want to copy/move. Then, use the
:cppcommand to copy the item to the root of the other panel’s directory tree. Use the
:mvpcommand to move the item to the other panel.
brootto delete a selected file or directory.
Create a new directory within the one you currently have selected using the
:mdcommand followed by the name of the new directory.
broot has many more features and capabilities to explore. It is a good option if you want more search options and the ability to export directory trees. You can keep going with some of the basics of
broot by referring to their GitHub readme. To go deeper into some of the more advanced features of
broot, take a look at the official broot documentation.
This page was originally published on