"grep -r" in root-directory crashes system

i would suggest running grep only on parts of the filesystem where the string may be found. This depends on what you are searching for.

If you search for something

  • you created as any user or user configuration
    • /home
  • in any programm you installed
    • /usr /opt
  • anywhere in the logs
    • /var
  • anywhere in system configuration
    • /etc
  • your boot files
    • /boot
  • there are also
    • /tmp /mnt /media /root /run/media
  • and if you have a lot of time
    • /.snapshots /home/.snapshots

But please don’t search in:

  • /dev /proc /run /sys
    it may not end ever, or even crash

Please have a look at: Filesystem, Permissions:

But there may be also infos for you in:

https://man.archlinux.org/man/file-hierarchy.7

If you had told us what you are searching for, maybe someone would have been able to help you searching in the right place.

I do think using grep -r in / is bad practice

3 Likes