Broot - A new way to see and navigate directory trees

Overview

Broot

CI MIT Latest Version Chat on Miaou

A better way to navigate directories

Installation Instructions

Get an overview of a directory, even a big one

br -s

overview

Notice the unlisted?

That's what makes it usable where the old tree command would produce pages of output.

.gitignore files are properly dealt with to put unwanted files out of your way (you can ignore them though, see documentation).

Find a directory then cd to it

type a few letters

cd

Hit altenter and you're back to the terminal in the desired location.

This way, you can navigate to a directory with the minimum amount of keystrokes, even if you don't exactly remember where it is.

broot is fast and doesn't block (any keystroke interrupts the current search to start the next one).

Most useful keys for this:

  • the letters of what you're looking for
  • enter on the root line to go up to the parent (staying in broot)
  • enter to focus a directory (staying in broot)
  • esc to get back to the previous state or clear your search
  • and may be used to move the selection
  • altenter to get back to the shell having cd to the selected directory
  • :q if you just want to quit (you can use ctrlq if you prefer)

Never lose track of file hierarchy while you search

search

broot tries to select the most relevant file. You can still go from one match to another one using tab or arrow keys.

You may also search with a regular expression. To do this, add a / before the pattern.

And you have other types of searches, for example searching on file content (start with c/):

content search

You may also apply logical operators or combine patterns, for example searching test in all files except json ones could be !/json$/&c/test and searching carg both in file names and file contents would be carg|c/carg.

Once the file you want is selected you can

  • hit enter (or double-click) to open it in your system's default program
  • hit altenter to open it in your system's default program and close broot
  • hit ctrl to preview it (and then a second time to go inside the preview)
  • type a verb. For example :e opens the file in your preferred editor (which may be a terminal one)

blog: a broot content search workflow

Manipulate your files

mv

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.

Manage files with panels

When a directory is selected, do ctrl and you open another panel (you may open other ones, or navigate between them, with ctrl and ctrl).

custom colors tree

(yes, colors are fully customizable)

Using two panels, you can for example copy or move elements between them:

cpp

If you like you may do it Norton Commander style by binding :copy_to_panel to F5 and :move_to_panel to F6.

Preview files

Hit ctrl when a file is selected and the preview panel appears.

preview

preview

The preview panel stays synchronized with the selection in tree panels.

If your terminal is kitty, then the image preview is high definition:

kitty preview

Apply a standard or personal shortcut to a file

size

Just find the file you want to edit with a few keystrokes, type :e, then enter.

You can add verbs or configure the existing ones; see documentation.

And you can add shortcuts, for example a ctrl sequence or a function key

Replace ls (and its clones):

If you want to display sizes, dates and permissions, do br -sdp which gets you this:

replace ls

You may also toggle options with a few keystrokes while inside broot. For example hitting a space, a d then enter shows you the dates. Or a space, then h then enter and you see hidden files.

Sort, see what takes space:

You may sort by launching broot with --sort-by-size or --sort-by-date. Or you may, inside broot, type a space, then sd, and enter and you toggled the :sort_by_date mode.

When sorting, the whole content of directories is taken into account. So if you want to find on Monday morning the most recently modified files, launch br --sort-by-date ~.

If you start broot with the --whale-spotting option (or its shortcut -w), you get a mode tailored to "whale spotting" navigation, making it easy to determine what files or folders take space.

whales

And you keep all broot tools, like filtering or the ability to delete or open files and directories.

If you hit :fs, you can check the usage of all filesystems, so that you focus on cleaning the full ones.

fs

Sizes, dates, files counts, are computed in the background, you don't have to wait for them when you navigate.

check git statuses:

size

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. From there it's easy to edit, or diff, selected files.

blog: use broot and meld to diff before commit

Further Reading

See Broot's web site for instructions regarding installation and usage.

Comments
  • Next Versions - Please tell me what seems missing or desired

    Next Versions - Please tell me what seems missing or desired

    There's an issue asking for what is needed for 1.0.

    But 1.0 is meant to be available very soon. When there's no bug or no visible hole.

    Most ideas are for later. And here they can be written.

    opened by Canop 36
  • MacOs: alt-enter doesn't work for everybody (define another combination?)

    MacOs: alt-enter doesn't work for everybody (define another combination?)

    alt-enter on mac seems to do the same than enter.

    If some people are able to test on Mac, please tell me and watch this issue so that I can let you test before official release.

    Please people also check the version of broot you have is at least 0.11.3. I suspect some obsolete brew formula is still around.


    Please note that you always can remap yourself to another key combination:

    [[verbs]]
    key = "ctrl-o"
    execution = ":open_leave"
    
    bug 
    opened by Canop 36
  • Support emacs-style key binding

    Support emacs-style key binding

    It would be great to make the app more CLI-friendly. For example,

    • C-W: delete a word
    • C-U: delete a line completely

    Reference: https://caiorss.github.io/Emacs-Elisp-Programming/Keybindings.html

    Note that many CLI programs that works on a bash/zsh shell are compatible with these keybindings.

    opened by wookayin 31
  • Suggestion: vim mode

    Suggestion: vim mode

    I was thinking about a mode that would be more familiar to vim users. By default the keys would be commands:

    • j/k or down/up arrow - moving down/up
    • enter or i - (on a file) open it
    • enter - (on a directory) enter it exiting broot (aka cd in parent shell)
    • i - (on a directory) enter it staying in broot
    • u - go back (undo last enter directory) OR go up directory tree
    • / - enter search mode
    • h/l - moving up/down the tree (similar to https://github.com/Canop/broot/issues/179)
    • : - start typing a verb ... and possibly more.

    Search mode would be pretty much like the current broot behaviour with the only change being:

    • enter or esc - go back to navigation mode.

    What do you think? I think that would be something I would use by default.

    I'm happy to start implementing it and/or preparing a prototype for testing the UX. I envision having this mode accessible with a command line argument (--vim, --vim-mode) or a config file setting.

    opened by pierd 28
  • Broot fails to compile with cargo install

    Broot fails to compile with cargo install

    Broot fails to compile and this is the error message

    error[E0432]: unresolved import `nix::sys::epoll`
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:41:19
       |
    41 |     use nix::sys::epoll::*;
       |                   ^^^^^ could not find `epoll` in `sys`
    
    error[E0433]: failed to resolve: use of undeclared type `EpollCreateFlags`
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:49:33
       |
    49 |     let poll_fd = epoll_create1(EpollCreateFlags::empty())?;
       |                                 ^^^^^^^^^^^^^^^^ use of undeclared type `EpollCreateFlags`
    
    error[E0433]: failed to resolve: use of undeclared type `EpollEvent`
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:50:21
       |
    50 |     let mut event = EpollEvent::new(EpollFlags::EPOLLIN, 0);
       |                     ^^^^^^^^^^ use of undeclared type `EpollEvent`
    
    error[E0433]: failed to resolve: use of undeclared type `EpollFlags`
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:50:37
       |
    50 |     let mut event = EpollEvent::new(EpollFlags::EPOLLIN, 0);
       |                                     ^^^^^^^^^^ use of undeclared type `EpollFlags`
    
    error[E0433]: failed to resolve: use of undeclared type `EpollOp`
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:53:9
       |
    53 |         EpollOp::EpollCtlAdd,
       |         ^^^^^^^ use of undeclared type `EpollOp`
    
       Compiling proc-status v0.1.1
    error[E0433]: failed to resolve: use of undeclared type `EpollEvent`
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:57:23
       |
    57 |     let mut events = [EpollEvent::empty(); 1];
       |                       ^^^^^^^^^^ use of undeclared type `EpollEvent`
    
    error[E0425]: cannot find function `epoll_create1` in this scope
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:49:19
       |
    49 |     let poll_fd = epoll_create1(EpollCreateFlags::empty())?;
       |                   ^^^^^^^^^^^^^ not found in this scope
    
    error[E0425]: cannot find function `epoll_ctl` in this scope
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:51:5
       |
    51 |     epoll_ctl(
       |     ^^^^^^^^^ not found in this scope
    
    error[E0425]: cannot find function `epoll_wait` in this scope
      --> /Users/nagybotond/.cargo/registry/src/github.com-1ecc6299db9ec823/xterm-query-0.1.0/src/lib.rs:58:20
       |
    58 |     let fd_count = epoll_wait(poll_fd, &mut events, timeout_ms)?;
       |                    ^^^^^^^^^^ not found in this scope
    
    Some errors have detailed explanations: E0425, E0432, E0433.
    For more information about an error, try `rustc --explain E0425`.
    error: could not compile `xterm-query` due to 9 previous errors
    warning: build failed, waiting for other jobs to finish...
    error: failed to compile `broot v1.14.0`, intermediate artifacts can be found at `/var/folders/18/br1lcr9s0js75bc8l464y8_m0000gn/T/cargo-installgrscap`
    

    uname -a Darwin computer.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64

    cargo --version cargo 1.64.0-nightly (c0bbd42ce 2022-07-03)

    bug 
    opened by westernwontons 26
  • selecting and operating on multiple files

    selecting and operating on multiple files

    Did a discussion occur before? No Is your feature request related to a problem? Please describe. A basic feature in file management is to select multiple files and operate move, copy etc on them. This is missing in this otherwise exceptionally brilliant tool.

    Describe the solution you'd like First there must be a mechanism to select (and deselect) multiple files (better if possible across multiple directories as in nnn), show the selected files by something like a + sign and the cp ,mv,cpp, mvp , rm commands should work on them.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    opened by asokmath 24
  • Make broot install the shell helper function

    Make broot install the shell helper function

    Hello! Thanks for writing this tool, it's novel and I'm excited to use it more. I am wondering if you're open to a helper flag in broot itself that outputs the entire br shell function to standard output. With this flag (let's call it --shell-helper for example), you could recommend users set up broot by downloading the binary and running broot --shell-helper | tee -a ~/.bashrc or similar. For additional flexibility, you could even read the value of the $SHELL env variable and output a version of br that's compatible with the user's shell (if it's not bash).

    enhancement 
    opened by delucks 23
  • br on ssh hangs indefinitely on large multi dir / multi project NVMe SSD

    br on ssh hangs indefinitely on large multi dir / multi project NVMe SSD

    Describe the bug br freezes on first letter when used via ssh, local usage works fine.

    To Reproduce Steps to reproduce the behavior:

    1. ssh localhost (only tested with actual remote machines)
    2. mkdir -p parity/polkadot; cd parity
    3. git clone https://github.com/paritytech/polkadot
    4. cd ..
    5. br
    6. p No more input is accepted, cannot send br to the background via CTRL + Z, can only terminate the terminal tab.

    Expected behavior no hang

    Screenshots If applicable, add screenshots to help explain your problem. image

    Configuration (please complete the following information):

    • OS: [e.g. iOS] Fedora
    • Version [e.g. 22] broot 1.0.3

    Additional context Add any other context about the problem here.

    opened by drahnr 22
  • broot + kitty does not display images in high resolution

    broot + kitty does not display images in high resolution

    Describe the bug My kitty terminal is correctly set up and capable of showing high resolution images with its icat native protocol, but somehow broot only shows low resolution images:

    Screenshot_20210626_001

    I cannot run BROOT_LOG=debug br on my Debian machine; can't try on my other machine running Solus right now:

    user@debian-sid:/$ BROOT_LOG=debug br
    thread 'main' panicked at 'Log file can't be created: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/cli-log-2.0.0/src/init.rs:30:14
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    To Reproduce

    • Open kitty and run broot (tested with 1.2.2, 1.2.8 and 1.6.1 installed with cargo on Solus as well as Debian).
    • Ctrl on an image.

    Expected behavior The image should be shown in high resolution since kitty supports that and broot too. See example in nnn:

    Screenshot_20210626_003

    Configuration (please complete the following information):

    • broot version: 1.2.2, 1.2.8, 1.6.1
    • OS: Solus OS, Debian Sid (as an LXC container within Sailfish OS; screenshots above)
    • Version: both Solus and Debian Sid are rolling
    opened by Kabouik 21
  • [Feature request] Provide arm64 binaries for Android

    [Feature request] Provide arm64 binaries for Android

    Hi! I wanted to try out broot on my Android phone, so I downloaded the rpi binary in Termux, placed it in my $PATH, gave it execution permission and tried to run it:

    $ broot
    bash: /data/data/com.termux/files/home/bin/broot: No such file or directory
    

    On a hunch I checked the binary with file: I realized that the RPI binary targets 32-bit ARM while my device is arm64:

    $ file bin/broot
    bin/broot: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=ba1d76ea6f6bc078ffb5bd4c2439c65581c053fd, with debug_info, not stripped
    $ uname -a
    Linux localhost 3.10.108-lineageos-g6e870147270 #1 SMP PREEMPT Wed Jan 8 09:24:04 UTC 2020 aarch64 Android
    

    edit: after re-reading the file output and Termux Package Management wiki entry, it seems the issue could as well stem from the libc/dynamic linking part... I don't know a lot about those subjects 😁

    Would you consider providing arm64 binaries for Android users? I will also ask for its inclusion in Termux repository to make it proper :)

    Thanks for your work! 👍

    help wanted 
    opened by neitsab 21
  • Windows compatibility

    Windows compatibility

    In the next few days|weeks|centuries, I'll be attempting this.

    This will involve replacing termion with crossterm or pancurses... and do many changes.

    enhancement help wanted 
    opened by Canop 21
  • Open in vscode support

    Open in vscode support

    Hi. I was wondering if it would be possible to add support for opening with vscode. I already wrote a line that works, but I'm not sure if it's the best way. I just added this line: external("code", "code {directory}", FromParentShell).with_key(key!(alt-p)), in src\verb\builtin.rs in the vector that's returned from builtin_verbs() function. (In my case, I set alt+p as it's shortcut)

    enhancement 
    opened by mahdi739 1
  • Alt-Enter on Linux on path with space

    Alt-Enter on Linux on path with space

    When pressing "Alt-Enter" on file path with space on Linux, path appears to be not properly escaped and started $EDITOR sees only path until first space.

    bug 
    opened by kulak 8
  • feature request: Fuzzy verb matching

    feature request: Fuzzy verb matching

    Short example: unless I'm missing something the only way to get :copy_path executed is starting typing it in full until you're at :copy_p because that is the only match. That's a lot of typing when being used to fuzzy matching :) My muscle memory just wants to do something like :copa which would fuzzy match copy_path first. Shortcuts could solve this partly but configuring and learning them by heart isn't really for me me.

    I didn't look in the code but I'd assume it's a matter of replacing 'starts with query or equals some shortcut' with 'fuzzy matches query': note I left out shortcuts because I guess if this were to be implemented it should be a configurable mode since shortcuts and fuzzy matching together might clash too much.

    enhancement 
    opened by stinos 4
  • Searching in / and /proc freezes the application

    Searching in / and /proc freezes the application

    While #637 prevents freezing by just listing the root directory, any search activity at / or /proc still freezes broot (version 1.17.0) for me.

    I noticed the same issue with 'fd', while find seems to be the only tool so far which does not have this issue.

    Possibly related: https://github.com/sharkdp/fd/issues/288

    bug 
    opened by monkeyt00l 1
  • Find and replace

    Find and replace

    Since I'm sure you want more work maintaining this already-amazing tool...

    It occurred to me today that broot already has a lot of the features to support an incredible find/replace feature. It would basically look like the current content search workflow, but there would be a command to replace each occurrence of the search string with some other string (or a regex substitution). Naively, I think the implementation wouldn't be so hard; it would be just like the existing commands, except you'd need to be able to query the search string (this is not possible as far as I am aware).

    As far as I know, there aren't any good unix tools for interactive find and replace in a directory(perhaps vim has something, but I doubt it would be as fast/easy as it could be with broot).

    enhancement 
    opened by fredcallaway 2
Releases(v1.18.0)
Owner
Canop
Denys Séguret - Freelance Rust programmer - contact me for rates
Canop
Untree converts tree diagrams produced by tree back into directory file structures.

Untree: Undoing tree for fun and profit Untree converts tree diagrams produced by tree back into directory file structures. Let's say you have the fol

Alecto Irene Perez 91 Jan 1, 2023
TreeFlat - the simplest way to build & traverse a pre-order Tree in Rust

TreeFlat is the simplest way to build & traverse a pre-order Tree for Rust. Alpha-relase! If you build a Tree in pre-order, and display in pre-order,

Mario Montoya 22 Dec 16, 2022
Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.

null 6.5k Dec 31, 2022
Coding-challenge - Algorithms and Data-structures, problems and solutions in Rust language using cargo-workspaces

Coding Challenge LeetCode/Hackerrank e.t.c Using this as an opportunity to improve my knowledge of rust lang If you found this repo useful to you, add

Tolumide Shopein 17 Apr 24, 2022
Extra iterator adaptors, iterator methods, free functions, and macros.

Itertools Extra iterator adaptors, functions and macros. Please read the API documentation here How to use with cargo: [dependencies] itertools = "0.1

null 1.9k Dec 30, 2022
Array helpers for Rust's Vector and String types

array_tool Array helpers for Rust. Some of the most common methods you would use on Arrays made available on Vectors. Polymorphic implementations for

Daniel P. Clark 69 Dec 9, 2022
K-dimensional tree in Rust for fast geospatial indexing and lookup

kdtree K-dimensional tree in Rust for fast geospatial indexing and nearest neighbors lookup Crate Documentation Usage Benchmark License Usage Add kdtr

Rui Hu 152 Jan 2, 2023
Algorithms and Data Structures of all kinds written in Rust.

Classic Algorithms in Rust This repo contains the implementation of various classic algorithms for educational purposes in Rust. Right now, it is in i

Alexander González 49 Dec 14, 2022
Obake is a procedural macro for declaring and maintaining versioned data-structures.

Obake is a procedural macro for declaring and maintaining versioned data-structures. The name 'obake' is taken from the Japanese 'お化け (おばけ)', a class of supernatural beings in Japanese folklore that shapeshift.

Nathan Corbyn 174 Dec 26, 2022
A simple rust library to help create octrees and quadtrees for chunked level of detail

LodTree LodTree, a simple tree data structure for doing chunk-based level of detail. Goals The aim of this crate is to provide a generic, easy to use

Dimev 14 Dec 29, 2022
Serialize/DeSerialize for Rust built-in types and user defined types (complex struct types)

Serialize/DeSerialize for Rust built-in types and user defined types (complex struct types)

null 2 May 3, 2022
Rust-algorithm-club - Learn algorithms and data structures with Rust

Rust Algorithm Club ?? ?? This repo is under construction. Most materials are written in Chinese. Check it out here if you are able to read Chinese. W

Weihang Lo 360 Dec 28, 2022
Common data structures and algorithms in Rust

Contest Algorithms in Rust A collection of classic data structures and algorithms, emphasizing usability, beauty and clarity over full generality. As

Aram Ebtekar 3.3k Dec 27, 2022
A hashmap implementation, which uses hashset, and keys are contained within values.

A hashmap implementation, which uses hashset, and keys are contained within values.

Piotr Mikulski 2 Nov 29, 2022
Rust data structures and client for the PubChem REST API

pubchem.rs Rust data structures and client for the PubChem REST API. ?? Usage ?? Compound Create a Compound to query the PubChem API for a single comp

Martin Larralde 2 Jan 18, 2022
Fast, efficient, and robust memory reclamation for concurrent data structures

Seize Fast, efficient, and robust memory reclamation for concurrent data structures. Introduction Concurrent data structures are faced with the proble

Ibraheem Ahmed 240 Dec 23, 2022
A scalable message queue powered by a segmented, partitioned, replicated and immutable log.

A scalable message queue powered by a segmented, partitioned, replicated and immutable log. This is currently a work in progress. laminarmq is intende

Arindam Das 20 Dec 16, 2022
rust_aads - Rust Algorithms And Data Structures

rust_aads - Rust Algorithms And Data Structures rust_aads is an open repository with algorithms and data structures, used in computer science and comp

stepa 2 Dec 15, 2022
A number of collections, such as linked-lists, binary-trees, or B-Trees are most easily implemented with aliasing pointers.

StaticRc is a safe reference-counted pointer, similar to Rc or Arc, though performing its reference-counting at compile-time rather than run-time, and

null 372 Dec 19, 2022
A faster way to navigate your filesystem

zoxide A faster way to navigate your filesystem Table of contents Introduction Examples Getting started Step 1: Install zoxide Step 2: Install fzf (op

Ajeet D'Souza 8.7k Jan 8, 2023