Skip to content

Instantly share code, notes, and snippets.

@takeshixx
Last active December 28, 2015 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takeshixx/7466377 to your computer and use it in GitHub Desktop.
Save takeshixx/7466377 to your computer and use it in GitHub Desktop.
$shell (zsh,bash,etc.) search functions
# search all with wildcard
function saw(){
find / -regextype posix-extended -iregex ".*\/[^\/]*$@.*" -exec ls -lad --color {} \; 2>/dev/null
}
# search all with exact match
function sa(){
find / -regextype posix-extended -iregex ".*\/$@" -exec ls -lad --color {} \; 2>/dev/null
}
# search local with wildcard
function slw(){
find . -regextype posix-extended -iregex ".*\/[^\/]*$@.*" -exec ls -lad --color {} \; 2>/dev/null
}
# search local with exact match
function sl(){
find . -regextype posix-extended -iregex ".*\/$@" -exec ls -lad --color {} \; 2>/dev/null
}
# show which files contain a keyword
function gg(){
grep -isl $@ *
}
# show which files contain a keyword (recursively)
function ggr(){
grep -risl $@ *
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment