• Stars
    star
    9,958
  • Rank 3,518 (Top 0.07 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 6 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A new way to see and navigate directory trees : https://dystroy.org/broot

Broot

Tests MIT Latest Version Chat on Miaou Packaging status

A better way to navigate directories

Complete Documentation - Installation Instructions - Contributing or Getting Help

Get an overview of a directory, even a big one

Hit 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.

As you sometimes want to see gitignored files, or hidden ones, you'll soon get used to the alti and alth shortcuts to toggle those visibilities.

(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
  • alth to toggle showing hidden files (the ones whose name starts with a dot)
  • alti to toggle showing gitignored files
  • :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

Most often, when not using broot, 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.

mv

Move, copy, rm, mkdir, are built in and you can add your own shortcuts.

Here's chmod:

chmod

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)

You can for example copy or move elements between panels:

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.

Broot displays images in high resolution when the terminal supports Kitty's graphics protocol (compatible terminals: Kitty, WezTerm):

kitty preview

Apply a standard or personal command 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

Apply commands on several files

Add files to the staging area then execute any command on all of them.

staging mv

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 hit alth 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.

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

size

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

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.

size

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.

gg

From there it's easy to edit, diff, or revert selected files.

blog: use broot and meld to diff before commit

Further Reading

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

More Repositories

1

bacon

background rust code check
Rust
1,399
star
2

termimad

A library to display rich (Markdown) snippets and texts in a rust terminal application
Rust
834
star
3

rhit

A nginx log explorer
Rust
806
star
4

dysk

A linux utility to get information on filesystems, like df but better
Rust
780
star
5

miaou

A chat server with OAuth2 authentication, persistent and searchable history, video and audio, markdown formatting, private and public rooms, stars, votes, embedded games, and many other features
JavaScript
536
star
6

lazy-regex

lazy static regular expressions checked at compile time
Rust
172
star
7

JSON.prune

A pruning version of JSON.stringify, allowing for example to stringify window or any big or recursive object
JavaScript
159
star
8

backdown

A deduplicator
Rust
94
star
9

safecloset

Cross-platform Secure TUI Secret Locker
Rust
81
star
10

hu.js

A very light JavaScript library for SVG
JavaScript
71
star
11

resc

A task orchestrator using redis, written in rust
Rust
63
star
12

clap-help

A more compact help renderer for clap terminal applications
Rust
56
star
13

whalespotter

Find those big fat files and folders
Rust
53
star
14

lapin

A game I built under direction of my kids
Rust
49
star
15

codesort

codesort sorts code
Rust
43
star
16

glassbench

A micro-benchmark framework to use with cargo bench
Rust
40
star
17

mazter

Mazes in your terminal
Rust
35
star
18

bet

Build and evaluate binary expression trees
Rust
33
star
19

tzdetect.js

A JavaScript library to detect the timezone using Moment.js
JavaScript
31
star
20

clima

A minimal viewer for Termimad
Rust
30
star
21

nvim-bacon

bacon's companion for neovim
Lua
29
star
22

deser-hjson

A Serde 1.0 compatible Rust deserializer for Hjson
Rust
27
star
23

minimad

Rust Markdown Parser
Rust
23
star
24

crokey

Rust
22
star
25

snow

Make it snow on your web site
JavaScript
21
star
26

coolor

tiny color conversion library for TUI application builders
Rust
17
star
27

wasm-tictactoe

Example of a 100% pure Rust, framework free, wasm application
Rust
15
star
28

lfs-core

rust crate to get information on mounted disks on linux
Rust
15
star
29

splitty

A Rust string splitter taking quotes into account
Rust
15
star
30

fediback

A Mastodon account backuper
Rust
14
star
31

Chrall

Extension Chrome pour Mounty Hall
JavaScript
14
star
32

print_key

an utility printing the key combinations you try on your terminal
Rust
14
star
33

JSON.parseMore

A not eval based JSON parser handling NaN and infinities
JavaScript
12
star
34

csv2svg

Rust
12
star
35

starry

A tool to collect github stars counts
Rust
12
star
36

terminal-light

Tells you whether the terminal is "dark" or "light"
Rust
11
star
37

patine

A minimalist color scheme for vim
Vim Script
11
star
38

SpaceBullet

JavaScript
11
star
39

terminal-clipboard

A cross-platform text only clipboard facade for terminal applications written in Rust
Rust
10
star
40

umask

A utility to deal with unix access permission modes
Rust
9
star
41

bounded-cache

A fast in memory cache forgetting the least recently accessed entry when the maximal number of entries is reached.
JavaScript
8
star
42

dys-config

Personal configuration files, for easier sharing between all my computers
Vim Script
7
star
43

squale

Small utility to scale images
Rust
6
star
44

miaou.gpt

A chat bot for Miaou, using the OpenAPI API
JavaScript
6
star
45

cli-log

a simple file logging facility, convenient for Rust terminal applications
Rust
5
star
46

skillrep

A small experiment at recomputing Stack Exchange reputation for evaluating skills
Go
5
star
47

braldop

Extensions du jeu Braldahim
JavaScript
5
star
48

keybindings-example

Rust
4
star
49

locmess

draws an histogram of the lengths of your LOC
Rust
4
star
50

bench-config-deserializers

A benchmark of Rust/serde deserializers on configuration files
Rust
4
star
51

anolog

access log anonymizer
Rust
3
star
52

termux-clipboard

Rust
3
star
53

yaml-patcher

An utility to change values in YAML files
Rust
3
star
54

char_reader

A buffered char reader for rust, not breaking on wild contents
Rust
3
star
55

kidding

Rust
2
star
56

strict

Rust
2
star
57

jacquerie

Similar to jQuery but without the burden of history
JavaScript
2
star
58

weblowercaser

A small program to change all file names and internal links in lowercase
Go
2
star
59

dom-doll

A nano Javascript lib to enchant the HTML DOM
JavaScript
2
star
60

mastodys-settings

stylesheet of the mastodon.dystroy.org Mastodon instance
CSS
2
star
61

secular

no diacr!
Rust
2
star
62

miaou.flying-toasters

No description or website provided
JavaScript
2
star
63

Canop

2
star
64

file-archive

A simple archiver storing files in a date based tree
JavaScript
1
star
65

dysp

Rust
1
star
66

albumin

Simple Hierarchical Album Generator
JavaScript
1
star
67

proc-status

a crate giving you information about a process, for example yours
Rust
1
star
68

groumf

Fast search and replace on strings or dom elements
JavaScript
1
star
69

domus

A DOM library that I hope to be able to forget soon enough (don't use it)
Rust
1
star
70

war-js

A repo for the SO JS ROOM GAME COMPETITION , and remake of Scratch W.A.R.
JavaScript
1
star
71

miaou.mountyhall

A plugin for miaou, dedicated to the MountyHall game
JavaScript
1
star
72

xterm-query

utility to query the terminal
Rust
1
star
73

byo-graphql

A simple "bring your own types and queries" GraphQL client
Rust
1
star
74

prompter

bash prompt designer
HTML
1
star
75

file-size

just a Rust function formatting file sizes in 4 chars
Rust
1
star
76

miaou.fireworks

A command to launch Fireworks in Miaou chat rooms
JavaScript
1
star
77

taliner.js

Is the caret on the first line of the textarea ? On the last line ?
HTML
1
star
78

canop.github.com

1
star
79

walk_pace

A simple evaluation of the cost of using rust's standard WalkDir
Rust
1
star