Skip to content

Instantly share code, notes, and snippets.

@verityj
Last active June 21, 2023 11:23
Show Gist options
  • Save verityj/1baf59b95a7da5f03a44ce0620a4253d to your computer and use it in GitHub Desktop.
Save verityj/1baf59b95a7da5f03a44ce0620a4253d to your computer and use it in GitHub Desktop.
Shell script: search everywhere for a string (not case sensitive) - do not show errors
#!/bin/zsh
# Written by: VerityJ
# Published on: https://gist.github.com/verityj
#
# Usage: ./find-all.sh search-string
# search-string does not need " or *
if [ -z "$1" ]
then
echo "Usage: ./find-all.sh search-string (note: no need for \" or *)"
exit 0
fi
printf "\nSearching everywhere for \"*$1*\" (case-insensitive) ...\n\n"
find / -iname "*$1*" -not -path "/System/Volumes/Data/*" -print 2>/dev/null
@verityj
Copy link
Author

verityj commented Jun 15, 2023

Option: copy this script into /usr/local/bin. You may rename it mv find-all.sh find-all.

In that case, from anywhere in the system, you can type:

$ find-all something

Searching everywhere for "*something*" (case-insensitive) ...

$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment