-- Leo's gemini proxy

-- Connecting to www-gem.srht.site:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

░█░█░█░█░█▀█░▀█▀░░░█░█░█▀█░█▀▀░░░█░█░█▀▄░█▀█░█▀█░█▀▀
░█▄█░█▀█░█▀█░░█░░░░█▄█░█▀█░▀▀█░░░█▄█░█▀▄░█░█░█░█░█░█
░▀░▀░▀░▀░▀░▀░░▀░░░░▀░▀░▀░▀░▀▀▀░░░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀▀

WWW in French

What Was Wrong

Other posts

================================================================


23 April 2021


In this post, I would like to share 3 awesome commandline tools that I use as replacement for find, grep, and cat. All of them bring some features that improve my productivity beyond what I could expect from the use of "simple" commands.


fd

fd github


fd is a simple commandline tool to search entries in your filesystem. It is comparable to the default command find with less functionalities. So the first question will be why one would like to go with a less powerful tool than the default one?

And the answer is because what fd offers may be sufficient to some and in that case it will offer very nice features like:


Intuitive syntax: fd PATTERN instead of find -iname '*PATTERN*'

Regular expression (default) and glob-based patterns

Very fast due to parallelized directory traversal

Colors to highlight different file types (same as ls)

Support for parallel command execution

Smart case: the search is case-insensitive by default. It switches to case-sensitive if the pattern contains an uppercase character*

Ignores hidden directories and files, by default

Ignores patterns from your .gitignore, by default



Here are some few examples of what to expect from fd:


Quick search

> > fd netfl


Regular expression search

> > cd /etc

> > fd '^x.*rc$'

> X11/xinit/xinitrc

> X11/xinit/xserverrc


Specifying the root directory

> > fd passwd /etc

> /etc/default/passwd

> /etc/pam.d/passwd

> /etc/passwd


List all files, recursively

> > cd fd/tests

> > fd

> testenv

> testenv/mod.rs

> tests.rs


Searching for a particular file extension

> > cd fd

> > fd -e md

> CONTRIBUTING.md

> README.md


These are very few of the simple commands you can run but you can go quite complex and, for example, proceed to automatic command execution (more details on the official github).



ripgrep-all (rga)

rga github


rga is another commandline tool which can be used as a replacement for the traditional grep since it contains most of its features and is generally faster. rga wraps ripgrep (another replacement for grep) and enables it to search in pdf, docx, sqlite, jpg, movie subtitles (mkv, mp4)...


rga can search specific types of files. For example, rg -tpy foo limits your search to Python files and rg -Tjs foo excludes JavaScript files from your search. ripgrep can be taught about new file types with custom matching rules.

rga supports many features found in grep, such as showing the context of search results, searching multiple patterns, highlighting matches with color and full Unicode support. Unlike GNU grep, ripgrep stays fast while supporting Unicode (which is always on).

rga supports searching files compressed in a common format (brotli, bzip2, gzip, lz4, lzma, xz, or zstandard) with the -z/--search-zip flag.

rga supports arbitrary input preprocessing filters which could be PDF text extraction, less supported decompression, decrypting, automatic encoding detection and so on.


And there are way more power to discover on the official github.



bat

bat github


bat is a replacement of cat. The main advantage of bat is taht it supports syntax highlighting for a large number of programming and markup languages. In other words, when using bat the output will be colorized according to the language of the sourcefile and lines will be numbered which make it very handy to read.


bat can also be integrated with other tools like fzf, find or fd, ripgrep, tail, git, and xclip.


To discover more, go to the bat github.



📬 contact me: www-gem@tuta.io


-- Response ended

-- Page fetched on Thu May 9 07:49:09 2024