I’ve been watching Prag Dave’s Elixir course and I noticed he uses tree:
Tree is a recursive directory listing program that produces a depth indented listing of files. Color is supported ala dircolors if the LS_COLORS environment variable is set, output is to a tty, and the -C flag is used. With no arguments, tree lists the files in the current directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.
In short, a heck ton of them. I can write a series of articles about which tools I use. I made it a credo to gather as much as possible CLI and TUI tools and become master at them. The latter part still eludes me – not enough time and energy still – but I have become quite the small encyclopaedia of CLI/TUI tools.
Waiting for Aston’s “you should write a blog about it Dimi!”.
I like a tool called tl;dr.
It gives you basic knowledge of many commands.
On macOS it’s a good’ol brew install tldr
They also have a nodejs client, so it can be installed with npm.
EG:
❯ tldr grep
grep
Find patterns in files using regular expressions.
More information: <https://www.gnu.org/software/grep/manual/grep.html>.
- Search for a pattern within a file:
grep "search_pattern" path/to/file
- Search for an exact string (disables regular expressions):
grep --fixed-strings "exact_string" path/to/file
- Search for a pattern in all files recursively in a directory, showing line numbers of matches, ignoring binary files:
grep --recursive --line-number --binary-files=without-match "search_pattern" path/to/directory
- Use extended regular expressions (supports `?`, `+`, `{}`, `()` and `|`), in case-insensitive mode:
grep --extended-regexp --ignore-case "search_pattern" path/to/file
- Print 3 lines of context around, before, or after each match:
grep --context|before-context|after-context=3 "search_pattern" path/to/file
- Print file name and line number for each match:
grep --with-filename --line-number "search_pattern" path/to/file
- Search for lines matching a pattern, printing only the matched text:
grep --only-matching "search_pattern" path/to/file
- Search stdin for lines that do not match a pattern:
cat path/to/file | grep --invert-match "search_pattern"
If a command does not exist, you can add it with a PR on their repo.
It’s a community-based FOSS tool.
Saves me a ton of time in googling and reading man pages.
bat: I can completely vouch for it, it made my surfing in projects much much better. Had to open everything in Emacs before discovering it. And I am not quite at learning nvim just yet. Oh, and bonus for opening files in read-only mode (it’s a viewer after all). Spared me from accidentally edit things I shouldn’t.
fzf also changed my life. Hop in a directory, type bat , press Ctrl-T, pick what file to open by fuzzy-finding its name, press Enter twice, done. It’s going much further than that but that’s a matter for a bigger topic.
fd: a file finder, a much faster find. Automatically ignores most things that should be ignored in dev projects; if that’s not desired and you want to look through all files you just pass fd -HI and still find whatever you need. Called fd-find in various repos, Homebrew and some Linuxes included.
Recently got introduced to jless in HN. Absolutely amazing!
In addition, another I use more than I thought I would is broot, It’s a simple TUI to let you rather efficiently “explore directory trees and launch commands”, it has a surprising amount of functionality.
Edit: I forgot my most favorite tool, cal. It saves me from taking the cursor to the auto-hidden menu-bar to see the date. It shows me the whole calendar instead of just the date, with the current date highlighted.
If you are on Mac or Linux, it’s already there on your computer.
Running; cal displays the current month, cal -3 displays prev/current/next months cal -j displays days of the year instead of days of the current month cal -y displays the whole year cal 2023 displays Calendar of 2023 cal 02 2023 displays Febraury 2023