This script is a Bash script designed to search for a specific string within files in a given directory
-
Check Existing Command:
First, navigate to the
/usr/bin
directory to check if the command name already exists using:ls *fileSearcher*
or
test -e fileSearcher && echo "Command exists." || echo "Command does not exist."
-
Move Script to
/usr/bin
:If the command does not exist, move the script to the
/usr/bin
directory using:sudo cp fileSearcher /usr/bin
-
Set Execution Permissions:
Make the script executable by running:
sudo chmod +x /usr/bin/fileSearcher
Once installed, the fileSearcher
command can be used to search for files with a specific extension containing a specific string.
Example usage:
fileSearcher -t pdf -n "modules" -d ./Desktop/books
-t
: Specify the file extension.-n
: Specify the string to search for.-d
: Specify the directory to search in.