Do you use rg (ripgrep) all the time on the command line? Yes, so do I. An annoying problem with it is that, by default, it does not search hidden directories.

"A file or directory is considered hidden if its base name starts with a dot character (.)."

One such directory, that is very important in my git/GitHub-based projects (which is all of mine by the way) is the .github directory. So I cd into a directory and it finds nothing:


cd ~/dev/remix-peterbecom
rg actions/setup-node
# Empty! I.e. no results

It doesn't find anything because the file .github/workflows/test.yml is part of a hidden directory.

The quick solution to this is to use --hidden:


❯ rg --hidden actions/setup-node
.github/workflows/test.yml
20:        uses: actions/setup-node@v4

I find it very rare that I would not want to search hidden directories. So I added this to my ~/.zshrc file:


alias rg='rg --hidden'

Now, this happens:


❯ rg actions/setup-node
.github/workflows/test.yml
20:        uses: actions/setup-node@v4

With that being set, it's actually possible to "undo" the behavior. You can use --no-hidden


❯ rg --no-hidden actions/setup-node

And that can useful if there is a hidden directory that is not git ignored yet. For example .download-cache/.

Comments

Your email will never ever be published.

Previous:
fnm is much faster than nvm. December 28, 2023 Node, macOS
Next:
How slow is Node to Brotli decompress a file compared to not having to decompress? January 19, 2024 Linux, Node, macOS
Related by category:
set -ex - The most useful bash trick of the year August 31, 2014 Linux
Be careful with Date.toLocaleDateString() in JavaScript May 8, 2023 macOS
brotli_static in Nginx November 8, 2024 Linux
Be very careful with your add_header in Nginx! You might make your site insecure February 11, 2018 Linux
Related by keyword:
Find the largest node_modules directories with bash September 30, 2022 Linux, Bash, macOS
The best grep tool in the world; ripgrep June 19, 2018 Linux, Web development, macOS
./bin/huey-isnt-running.sh - A bash script to prevent lurking ghosts June 10, 2020 Python, Linux, Bash
How I found out where a bash alias was set up May 9, 2018 Linux