nl
stringlengths
13
387
bash
stringlengths
1
532
Search /public/html/cosi for files whose name is "wiki.phtml"
find /public/html/cosi -name "wiki.phtml"
Search the /root directory recursively for files named "FindCommandExamples.txt"
find /root -name FindCommandExamples.txt
Search the /root directory recursively for the regular file named "myfile"
find /root/ -name myfile -type f
Search the /root directory recursively for the regular file named "myfile" ignoring "work" directories
find /root/ -name 'work' -prune -o -name myfile -type f -print
Search the /root directory recursively for the regular file named "myfile" ignoring /root/work/
find /root/ -path '/root/work' -prune -o -name myfile -type f -print
Search /root/directory/to/search recursively for the files matching pattern 'filename.*'
find /root/directory/to/search -name 'filename.*'
Search /some/directory for files that are owned by the user "joebob"
find /some/directory -user joebob -print
Search the /storage/sdcard0/tencent/MicroMsg/ directory tree for JPG files
find /storage/sdcard0/tencent/MicroMsg/ -type f -iname '*.jpg' -print0
Search the /tmp directory tree for files owned by user `ian'
find /tmp -user ian
Search the /tmp tree for files between 10kb and 20kb
find /tmp -size +10k -size -20k
Search the /tmp/ directory recursively for files matching regular expression ".*file[0-9]+$"
find /tmp -regex ".*file[0-9]+$"
Search the /tmp/ directory recursively for regular files
find /tmp -type f
Search the /usr/ directory tree for files newer than file /tmp/stamp
find /usr -newer /tmp/stamp
Search the /usr/bin directory tree for regular files accessed more than 100 days ago
find /usr/bin -type f -atime +100
Search the /usr/bin directory tree for regular files modified or created less than 10 days ago
find /usr/bin -type f -mtime -10
Search /usr/bin for regular files that were last accessed more than 100 days ago
find /usr/bin -type f -atime +100
Search /usr/local for subdirectories whose names end with a number 0-9
find /usr/local -maxdepth 1 -type d -name '*[0-9]'
Search the /usr/local/doc directory tree for .texi files
find /usr/local/doc -name '*.texi'
Search /usr/src for filenames not ending in "*,v"
find /usr/src ! \( -name '*,v' -o -name '.*,v' \) '{}' \; -print
Search /var for files matching regular expression '.*/tmp/.*[0-9]*.file'
find /var -regex '.*/tmp/.*[0-9]*.file'
Search /var/log for logs larger than 10 megabytes
find /var/log -size +10M -ls
Search the /var/www/ tree for files not owned by user `apache'
find /var/www ! -user apache -print0 | xargs -0
Search the /var/www/ tree for files owned by root or unknown group and change their group to 'apache'
find /var/www -group root -o -nogroup -print0 | xargs -0 chown :apache
Search three folders named foo, bar, and baz for all "*.rb" files
find foo bar baz -name "*.rb"
search a url in all regular/normal files in a folder.
find ./ -type f -exec grep https://www.ksknet.net {} \;
search all the ".sh" files in the /usr folder and follow the symbolic links to their original file
find /usr -follow -name '*.sh'
Search all *.c files from the current directory tree for "hogehoge"
find . -name \*.c -exec grep hogehoge {} \;
Search all *.c files from the current directory tree for "hogehoge"
find . -name \*.c -print | xargs grep hogehoge
Search all *.c files from the current directory tree for "hogehoge"
find . -name \*.c -print0 | xargs -0 grep hogehoge /dev/null
Search all the *.pl files in the current directory and subdirectories, and print the names of any that don't have a line starting with 'use strict'
find . -name '*.pl' | xargs grep -L '^use strict'
Search all *.txt files under ~/documents for the word "DOGS"
find ~/documents -type f -name '*.txt' -exec grep -s DOGS {} \; -print
Search all the .c and .h files in the current directory tree for "expr"
find -name '*.[ch]' | xargs grep -E 'expr'
Search all .c files from the current directory tree for "keyword", ignoring the case
find . -name "*.c" -exec grep -i "keyword" {} ";"
Search all .py files in the current directory tree for "some_function"
find . -name \*.py | xargs grep some_function
search all block spacial files called backup from /usr directory downwards and print them .
find /usr -type b -name backup -print
Search all directories starting from the root directory for "filename"
find / -iname "filename"
Search all files and directories either of the directory /home/oracle and /home/databse which contain the "zip" anywhere in the files or directory name .
find /home/oracle /home/database -name '*zip*'
Search all files called "abc" that reside in the current directory tree for string "xyz"
find . -name "abc" -exec grep "xyz" {} \;
Search all files called "abc" that reside in the current directory tree for string "xyz"
find . -name abc | xargs grep xyz
Search all files from the /tmp directory tree for the string "search string"
find /tmp -type f -exec grep 'search string' '{}' /dev/null \+
Search all files in the current directory tree, except *.html and *.svn*, for "SearchString"
find . ! -name '*.html' ! -name '*.svn*' -exec grep 'SearchString' {} /dev/null \;
Search all files in the current directory tree, except GIT files, for "string-to-search"
find . -name .git -prune -o -print | xargs grep "string-to-search"
Search all files in the current directory tree for "SearchString", ignoring .html files and skipping .svn directories
find . \( -name '*.svn*' -prune -o ! -name '*.html' \) | xargs -d '\n' grep -Hd skip 'SearchString'
Search all files in the current directory tree that are named "whatever" for "you_search_for_it"
find -name whatever -exec grep --with-filename you_search_for_it {} \;
Search all files in the current directory tree whose names end in "1" for string "1"
find . -name "*1" -exec grep "1" {} +
Search all files in the current directory tree whose names end in "1" for string "1"
find . -name "*1" -exec grep "1" {} \;
Search all files in the current directory tree whose names end in "1" for string "1"
find . -name "*1" -print0 |xargs -0 grep "1"
search all the files in the current folder and assign them to a variable
files=`find .`
search all the files in the current folder excluding those that are present in the folder test and using regex
find . -name test -prune -regex ".*/my.*p.$"
search all the files in the current folder using name patterns
find . -name 'a(b*' -print
search all the files in the current folder using regex
find . -regex ".*/my.*p.$"
search all the files in the current folder using regex excluding those that are present in the folder test
find . -name test -prune -o -regex ".*/my.*p.$"
search all the files in the folder "myfiles" which have the word "blue" in their name
find /myfiles -name '*blue*'
search all jpg files in current folder
find . -type f -name "*.jpg"
search all the lines that start with the word malloc in the files ending with .c or .h or .ch
grep ^malloc `find src/ -name '*.[ch]'`
search all mp3 files in the folder "/home/you" which have been modified yesterday (from the start of day 00:00 to 23:59)
find /home/you -iname "*.mp3" -daystart -type f -mtime 1
Search all of /usr for any directory named 'My Files', for each directory found, copy it to /iscsi preserving full paths and attributes.
find /usr -type d -name My\ Files -exec rsync -avR '{}' /iscsi \;
Search all of /usr for any directory named 'My Files', for each directory found, copy it to /iscsi preserving full paths and attributes, then remove it.
find /usr -type d -name 'My Files' -exec rsync -avR '{}' /iscsi \; -exec rm -rf '{}'\;
Search all Python files in the current directory tree for string "import antigravity"
find . -name "*.py" | xargs grep 'import antigravity'
Search all the regular files from the current directory tree for "search string"
find . -type f -print -exec grep --color=auto --no-messages -nH "search string" "{}" \;
Search all regular files in the current directory tree for "example"
find -type f -print0 | xargs -r0 grep -F 'example'
Search all the regular files in the current directory tree for "example"
find -type f -print0 | xargs -r0 grep -F 'example'
Search all regular files in the current directory tree for "string"
find . -type f -exec grep string {} \;
Search all regular files in the current directory tree for "string"
find . -type f | xargs -d '\n' grep string
search all undo files(ending with .undo) in the current folder and calculate the total size of them
find -name '*.undo' -exec wc -c {} + | tail -n 1
search all undo files(ending with .undo) in the current folder and calculate the total size of them
find -name '*.undo' -exec wc -c {} + | tail -n 1 | cut -d' ' -f 1
Search all variables and their values for "NAME"
env | grep NAME
Search appended data in "logfile.log" for "something" with a timeout of 3 seconds
tail -f logfile.log | grep --line-buffered "something" | read -t 3
Search case insensitively for 'facebook', 'xing', 'linkedin', ''googleplus' in file 'access-log.txt', extract the matched part, sort them and print them by sorting them in asending order of the number of repeated lines
grep -ioh "facebook\|xing\|linkedin\|googleplus" access-log.txt | sort | uniq -c | sort -n
Search case insensitively for 'foo' in all the files with '.java' extension under current directory tree and show only the file names
find . -type f -name "*.java" -exec grep -il 'foo' {} \;
search character special files called ' backup ' from /usr directory downwards and print them .
find /usr -type c -name backup -print
Search core files in current direcory and delete .
find . -name core -exec rm {} \;
Search the CSS files found in the current directory tree for string "foo"
find . -name \*.css -print0 | xargs -0 grep -nH foo
Search the current directory and two levels below for file `teste.tex'
find ~/ -maxdepth 3 -name teste.tex
Search the current directory and all of its sub-directory for any PDF files.
find . -name "*.pdf" -print
Search the current directory and all of its sub-directories for the file 'file1'.
find . -name file1 -print
Search the current directory and all subdirectories for files that have 777 permissions and the permissions to 755
find . -type f -perm 777 -exec chmod 755 {} \;
Search the current directory and directories below for .sql files
find . -name \*.sql
Search the current directory and its sub-directories for any file that has "bsd" somewhere in its name.
find . -name "*bsd*" -print
Search the current directory for all files with no 'read' privilege for 'others'
find . -maxdepth 1 ! -perm -o=r
Search the current directory for all regular files executable by 'user', 'group', and 'others'
find . -maxdepth 1 -type f -perm -ugo=x
Search the current directory for files whose names start with my
find . -name 'my*'
Search the current directory for files whose names start with "messages." ignoring SVN files
find \( -name 'messages.*' ! -path "*/.svn/*" \) -exec grep -Iw uint {} +
Search the current directory for files whose names start with "messages." ignoring SVN, GIT, and .anythingElseIwannaIgnore files
find -name 'messages.*' -exec grep -Iw uint {} + | grep -Ev '.svn|.git|.anythingElseIwannaIgnore'
Search the current directory for files whose names start with "messages." ignoring SVN, GIT, and .anythingElseIwannaIgnore files
find . -type f -print0 | xargs -0 egrep messages. | grep -Ev '.svn|.git|.anythingElseIwannaIgnore'
Search the current directory for HTML files whose names begin with "a"
find . -maxdepth 1 -name a\*.html
Search the current directory for PHP files
find . -type f -name "*.php"
Search the current directory for regular files whose names start with my
find . -name 'my*' -type f
Search the current directory recursively for *.txt files with lines that match regular expression "^string"
find . -name "*.txt" -exec egrep -l '^string' {} \;
Search the current directory recursively for .m4a files
find . -type f -iname *.m4a -print
Search the current directory recursively for .sh files whose names begin with "new"
find . -name "new*.sh"
Search the current directory recursively for files containing "string"
find . -type f -exec grep -l 'string' {} \;
Search the current directory recursively for files last modified within the past 24 hours
find . -mtime 0
Search the current directory recursively for files last modified within the past 24 hours ignoring .swp files and "en" and "es" directories
find . \( -name en -o -name es \) -prune , -mtime 0 ! -name "*.swp"
Search the current directory recursively for files last modified within the past 24 hours ignoring .swp files and paths ./es* and ./en*
find "$(pwd -P)" -mtime 0 -not \( -name '*.swp' -o -regex './es.*' -o -regex './en.*' \)
Search the current directory recursively for files last modified within the past 24 hours ignoring .swp files and paths ./es* and ./en*
find -mtime 0 -not \( -name '*.swp' -o -path './es*' -o -path './en*' \)
Search the current directory recursively for files last modified within the past 24 hours ignoring .swp files and paths ./es* and ./en*
find . -mtime 0 -not \( -name '*.swp' -o -regex '\./es.*' -o -regex '\./en.*' \)
Search the current directory recursively for files last modified within the past 24 hours ignoring .swp files and paths ./es* and ./en*
find . -mtime 0 | grep -v '^\./en' | grep -v '^\./es' | grep -v .swp
Search the current directory recursively for files last modified within the past 24 hours ignoring paths ./es* and ./en*
find . -mtime 0 | grep -v '^\./en' | grep -v '^\./es'
Search the current directory recursively for files whose size is between 10 and 50 MB
find . -size +10M -size -50M -print