Files and shell

Search for text inside files

Find every file in a project that contains a word, with the line numbers.

Fill these in once
  1. Search this folder and everything below it
    Terminal
    grep -rn "TODO" .

    Add -i to ignore upper and lower case. Add -l to list only file names.

  2. Faster, and skips node_modules and .git (ripgrep)
    Terminal
    brew install ripgrep && rg "TODO"
  1. Search this folder and everything below it
    Terminal · Ubuntu / Debian
    grep -rn "TODO" .

    Add -i to ignore upper and lower case. Add -l to list only file names.

  2. Faster, and skips node_modules and .git (ripgrep)Needs sudo
    Terminal · Ubuntu / Debian
    sudo apt install -y ripgrep && rg "TODO"
  1. Search this folder and everything below it
    PowerShell
    Get-ChildItem -Recurse -File | Select-String -Pattern "TODO" -SimpleMatch
  2. Faster, and skips node_modules and .git (ripgrep)
    PowerShell
    winget install BurntSushi.ripgrep.MSVC; rg "TODO"

    Reopen PowerShell after installing before running rg.