Fails to search /etc without explicit listing it

Author: MaxG87Created Nov 14, 2025Updated Nov 14, 2025

Today I wanted to learn why one of my systems has EDITOR set and another not. To avoid having to think hard I did what was more convenient: A full-system full-text search. Unfortunately this failed to find the relevant file /etc/environment.

This command does not find it:

bash
$ cd /
$ ag 'EDITOR' / 2>/dev/null -l | grep etc
$ # no output

However, this command does find it:

bash
$ cd /
$ ag 'EDITOR' /etc 2>/dev/null -l | grep etc
/etc/environment
/etc/mail.rc
/etc/neomuttrc
/etc/texmf/xdvi/XDvi

I'd like to better understand this behaviour! Why is ag ignoring /etc?

Source: ggreer/the_silver_searcher