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.
scfind, which stands for 'source code find', is a replacement for find
command for source code
files. It's ultra light and very fast.
- Install Go version at least 1.21
- Run command:
go install github.com/m-manu/scfind@latest
- Add following line in your
.bashrc
/.zshrc
file:export PATH="$PATH:$HOME/go/bin"
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
scfind ~/Programming
scfind . | xargs grep --color "LinkedHashSet"
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)
- e.g.
.java
,.go
,.py
,.yml
etc. - see full list
- e.g.
- Scans for files with certain names (case sensitive)
- e.g.
postinst
,Dockerfile
etc. - see full list
- e.g.
- Skips scanning certain directories (case sensitive)
- e.g.
.git
,.idea
,.gradle
etc. - see full list
- e.g.
- Skips scanning certain directories with specific peer files (case sensitive)
- e.g. skip
build
sub-directory whenbuild.gradle
exists in the same directory etc. - see full list
- e.g. skip