scfind
Why?
find
command in unix-like OSes is great. But, it is not helpful in searching for source code files or in searching
inside source code files (when used along with grep
). So, we need a specialized command.
What?
scfind, which stands for 'source code find', is a replacement for find
command for source code
files. It's ultra light and very fast.
How to install?
- Install Go version at least 1.18
- Run command:
go install github.com/m-manu/scfind@latest
- Add following line in your
.bashrc
/.zshrc
file:
export PATH="$PATH:$HOME/go/bin"
How to use?
Running scfind -h
shows this help message:
scfind is a 'find' command for source code files
Usage:
scfind DIRECTORY_PATH
where,
DIRECTORY_PATH is path to a readable directory that
you want to scan for source code files
For more details: https://github.com/m-manu/scfind
Examples
scfind ~/Programming
scfind . | xargs grep --color "LinkedHashSet"
How does this work?
scfind
command traverses file tree with source code awareness in following ways:
- Scans for files with known source code and configuration file extensions (case insensitive)
- Scans for files with certain names (case sensitive)
- Skips scanning certain directories (case sensitive)
- Skips scanning certain directories with specific peer files (case sensitive)
- e.g. skip
build
sub-directory when build.gradle
exists in the same directory etc.
- see full list