nl
stringlengths 13
387
| bash
stringlengths 1
532
|
|---|---|
search for the pattern "tgt/etc/file1" in the files tgt/etc/file2, tgt/etc/file3
|
find . -type f -name \* | grep tgt/etc/file1 tgt/etc/file2 tgt/etc/file3
|
Search for the pattern '^use strict' in all *.pl files under current directory
|
find . -name '*.pl' | xargs grep -L '^use strict'
|
search for the pattern in all the regular/normal files in the entire file system
|
find / -type f -print0 | xargs -0 grep -i pattern
|
search for pattern matched files in the current folder and subfolders exclude "excluded path"
|
find ./ -type f -name "pattern" ! -path "excluded path" ! -path "excluded path"
|
search for perl files in the folder /users/tom
|
find /users/tom -name "*.pl"
|
Search for the Perl regex "[\x80-\xFF]" in *.xml files under current directory tree
|
find . -name *.xml | xargs grep -P "[\x80-\xFF]"
|
search for php files in current directory and search for a word in all these files
|
find -name '*.php' -exec grep -iq "fincken" {} \; -exec grep -iq "TODO" {} \; -print
|
Search for the query "filename" in the current directory and any subdirectories
|
find -iname "filename"
|
Search for the regex "+\S\+" in file 'in.txt' and print the matches by replacing newlines with comma (',')
|
grep -o "+\S\+" in.txt | tr '\n' ','
|
Search for the regex "\$wp_version =" in all the regular files that end with '/wp-includes/version.php' (case insensitive) in their paths in directories/files taken from the glob pattern '/home/*//public_html/' and show the matched lines along with the file names
|
find /home/*/public_html/ -type f -iwholename "*/wp-includes/version.php" -exec grep -H "\$wp_version =" {} \;
|
Search for the regex "\$wp_version =" in all the regular files that end with '/wp-includes/version.php' (case insensitive) in their paths in directories/files taken from the glob pattern '/var/www/vhosts/*/httpdocs' and show the matched lines along with the file names
|
find /var/www/vhosts/*/httpdocs -type f -iwholename "*/wp-includes/version.php" -exec grep -H "\$wp_version =" {} \;
|
Search for the regex '->get(\|#hyphenate' in all files with '.pl' or '.pm' extension under '/users/tom' directory tree and only show the filenames
|
find /users/tom -name '*.p[lm]' -exec grep -l -- '->get(\|#hyphenate' {} +
|
Search for the regex '[0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*' in all files under /etc
|
find /etc -exec grep '[0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*' {} \;
|
Search for the regex '^ERROR' in all *.log files under current directory
|
find . -name "*.log" -exec egrep -l '^ERROR' {} \;
|
Search for the regex 'pattern_to_search' in all files under '/directory/containing/files' and show the matched lines as well as the file names
|
find /directory/containing/files -type f -exec grep -H 'pattern_to_search' {} +
|
Search for the regex ... in the manual of the find command
|
man find | grep ...
|
Search for the regex ^catalina in the first line of each file under current directory
|
find -type f | xargs head -v -n 1 | grep -B 1 -A 1 -e '^catalina'
|
Search for the regex expanded by the variable $SEARCH in all regular files under $DIR directory tree
|
find "$DIR" -type f -exec grep -q "$SEARCH" {} + ;
|
Search for the regex expaned by the variable $SEARCH in all regular files under $DIR directory tree
|
find "$DIR" -type f -exec grep "$SEARCH" {} \;
|
Search for regular expression 'expr' in all .c and .h files from the current directory tree
|
find -name '*.[ch]' | xargs grep -E 'expr'
|
search for the regular/normal file "Dateiname" in the entire file system
|
find / -type f -iname "Dateiname"
|
search for the regular/normal file "foo.bar" and force delete it
|
find /home -name foo.bar -type f -exec rm -f "{}" ';'
|
search for the regular/normal file "myfile" in the current folder excluding search in the paths of "work" and "home" sub directories
|
find . \( -name work -o -name home \) -prune -o -name myfile -type f -print
|
search for the regular/normal file 'myfile' in the folder /root excluding those that are present in the "work" directory
|
find /root/ -name 'work' -prune -o -name myfile -type f -print
|
search for the regular/normal file 'myfile' in the folder /root excluding those that are present in the /root/work directory
|
find /root/ -path '/root/work' -prune -o -name myfile -type f -print
|
search for regular files in the current folder which path is not "./.*" and not "./*/.*"
|
find ./ -type f -name "*" ! -path "./.*" ! -path "./*/.*"
|
Search for regular files of the user bluher in the file system
|
find / -type f -user bluher -exec ls -ls {} \;
|
search for the regulars file starting with HSTD which have been modified yesterday from day start and copy them to /path/tonew/dir
|
find . -type f -iname ‘HSTD*’ -daystart -mtime 1 -exec cp {} /path/to new/dir/ \;
|
search for regular/normal file with the name "myfile" in the entire file system
|
find / -name myfile -type f -print
|
search for soft links in current folder and display those links which are not pointed to files in current folder
|
find . -type l -exec readlink -f '{}' \; | grep -v "^`readlink -f ${PWD}`"
|
Search for the string "ERROR" in all XML files in the current working directory tree
|
find . -name "*.xml" -exec grep "ERROR" /dev/null '{}' \+
|
Search for the string 'device' in all regular files in the entire filesystem
|
find / -type f -print | xargs grep "device"
|
Search for the string 'git' in all the files under current directory tree excluding paths and names that contain the string 'git'
|
find . -not -path "*git*" -not -name '*git*' |grep git
|
search for swap files (.swp files) in temp folder and remove them
|
find /tmp -name '*.swp' -exec rm {} \;
|
search for text files in the current folder which do not have write access to others
|
find . -type f \( -iname "*.txt" ! -perm -o=w \)
|
search for text files in the current folder which do not have write access to others
|
find . -type f \( -iname "*.txt" -not -perm -o=w \)
|
search for text files in the folders /home/hobbes/ /home/calvin/
|
find /home/hobbes/ /home/calvin/ -name “*.txt”
|
search for text files in the folder /home/you which have been modified in the last 60*24 hours(case insensitive search) and display their contents
|
find /home/you -iname "*.txt" -mtime -60 -exec cat {} \;
|
Search for utility "foo" in PATH, display its file type description.
|
file $(which foo)
|
search for version in system.info files.
|
find /home/*/public_html/ -type f -iwholename "*/modules/system/system.info" -exec grep -H "version = \"" {} \;
|
search for the word "damian" in all the regular/normal files in the /etc folder and display only the matched file name
|
find /etc -type f | xargs grep -l -i "damian"
|
search for the word "methodNameHere" in all the python files in the folder "/mycool/project/" and display color on the matched lines in the output
|
find /mycool/project/ -type f -name "*.py" -print0 | xargs -I {} -0 grep -H --color "methodNameHere" "{}"
|
search for the word "mysql" in all the files in the current containing the word "notes" in their name
|
find . -iname "*notes*" | xargs grep -i mysql
|
search for the word "mysql" in all the files in the current containing the word "notes" in their name. print0 is used to handle files with newlines in their names or those which have only spaces in their names
|
find . -iname "*notes*" -print0 | xargs -I{} -0 grep -i mysql "{}"
|
search for the word "nameserver" in all the configuration files of the /etc folder
|
find /etc/ -type f -name "*.conf" -print0 | xargs -I {} -0 grep "nameserver" "{}"
|
search for the word "nameserver" in all the regular/normal files in the /etc directory and display the name of the file along with the matched line
|
find /etc/ -iname "*" -type f -print0 | xargs -0 grep -H "nameserver"
|
search for the word "put" in all the files in the current folder which have the word "bills" in their name and display the matched line along with the filename.
|
find . -name '*bills*' -exec grep -H "put" {} \;
|
search for the word "redeem reward" in all the regular/normal files in the current folder
|
find . -type f -exec grep -i “redeem reward” {} \; -print
|
search for the word "search-pattern" in all the regular/normal files in the current folder and display the matched file name
|
find . -type f | xargs grep -l "search-pattern"
|
search for the word "slrn" in all the files in the current folder
|
find ./ -exec grep -q 'slrn' '{}' \; -print
|
search for the word "slrn" in all the files in the folder $HOME/html/andrews-corner
|
find $HOME/html/andrews-corner -exec grep -q 'slrn' '{}' \; -print
|
search for the word bananas in the all the regular/normal files in the entire file system
|
find / -type f -exec grep bananas {} \; -print
|
search for the word error in all the xml files in the current folder
|
find . -name "*.xml" -exec grep "ERROR" /dev/null '{}' \+
|
search for the word LOG in all the files in the folder ~/jsmith
|
find ~jsmith -exec grep LOG '{}' /dev/null \; -print
|
Search the given $directory for files with permissions stored in $permissions
|
find "$directory" -perm "$permissions"
|
Search history for "part_of_the_command_i_still_remember_here"
|
history | grep 'part_of_the_command_i_still_remember_here'
|
Search the home directory for files accessed more than 10 days ago
|
find ~/ -atime +10
|
Search the home directory for files whose names begin with "test"
|
find ~ -name "test*" -print
|
Search the home directory for filenames starting with "xx" except for "xxx" files
|
find ~ -name 'xx*' -and -not -name 'xxx'
|
Search the home directory for OGG and MP3 files
|
find $HOME -iname '*.ogg' -o -iname '*.mp3'
|
Search the home directory tree for .tar.gz files newer than file "filename"
|
find ~/ -name *.tar.gz -newer filename
|
Search the home directory tree for all .txt files
|
find ~/ -name '*.txt'
|
Search the home directory tree for files last modified less than 2 days ago or newer than file "filename"
|
find ~/ -mtime -2 -o newer filename
|
Search the home directory tree for files last modified more than a year ago
|
find $HOME -mtime +365
|
Search the home directory tree for files matching pattern '*.txt'
|
find ~ -name *.txt
|
Search the home directory tree for files modified less than 7 days ago
|
find $HOME -mtime -7
|
Search the home directory tree for files modified less than a day ago
|
find $HOME -mtime -1
|
Search the home directory tree for files owned by sam
|
find /home -user sam
|
Search the home directory tree for regular files modified yesterday
|
find ~ -daystart -type f -mtime 1
|
Search the home directory tree for video files
|
find ~ -type f -name '*.mkv' -o -name '*.mp4' -o -name '*.wmv' -o -name '*.flv' -o -name '*.webm' -o -name '*.mov'
|
Search the home directory tree for video files
|
find ~ -type f -regex '.*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\)'
|
search in all the regular/normal files of the current folder for the word "word" and display the matched file name
|
find . -type f -exec grep -l "word" {} +
|
Search in the current directory and all sub-directories except ./D and any further sub-directories also named D for the file named hi.dat
|
$ find . \( -name D -prune \) -o -name hi.dat
|
Search in the current directory and all sub-directories except ./D for the file named hi.dat
|
find -path ./D -prune -o -name hi.dat -print
|
Search in the current directory and all sub-directories except ./D for the file named hi.dat.
|
find . \( -name D -prune \) -o -name hi.dat
|
Search in current directory downwards all files which have not been accessed since last 7 days
|
find . -atime +7 -print
|
Search in current directory downwards all files whic have permission 777 .
|
find . -perm 777 -print
|
search in current directory downwards all files which were accessed exactly 7 days back
|
find . -atime 7 -print
|
Search in current directory downwards all files whose owner is aa1 and grop is grp .
|
find . \( -user aa1 - group grp \) -print
|
Search in current directory downwards all files whose owner is aa1 or whose name is myfile .
|
find . \( -user aa1 -o -name myfile \) -print
|
Search in current directory downwards all files whose size is 10 blocks .
|
find . -size 10 print
|
Search in current directory downwards all files whose size is 10 bytes ( Characters ) .
|
find . -size 10c -print
|
Search in current directory downwards all files whose size is greater than 10 bytes .
|
find . -size +10c -print
|
search in current directory downwards all files whose size is less then 10 bytes
|
find . -size -10c -print
|
search in current directory downwards all files whose status has changed more then 7 days ago
|
find . -ctime +7 -print
|
search in the current directory for any file named Chapter1.txt
|
find . -name Chapter1 -type f
|
search in the current folder for all the directories with the name "test"
|
find . -type d -name test
|
search in the current folder for all the regular/normal file with the name "test"
|
find . -type f -name test
|
search in the current folder for the file "myletter.doc"
|
find . -name myletter.doc -print
|
search in the current folder for the file with the name "test"
|
find . -name test
|
search in the current folder for the file with the name "test" ( case insensitive search )
|
find . -iname test
|
search in the home folder for all the files with the name "monfichier"
|
find /home/ -name monfichier
|
search in root ( / ) directory downwards all files which have exactly 2 links.
|
find / -links 2 -print
|
search in root ( / ) directory downwards all files which have less than 2 links.
|
find / -links -2 -print
|
Search level 3 of the current directory tree for the directories whose pathnames contain "New Parts"
|
find -mindepth 3 -maxdepth 3 -type d | grep "New Parts"
|
Searches the manual page names and descriptions by 'disk' keyword.
|
apropos disk
|
Searches manual pages which descriptions contain 'postscript', and prints name and description of only ones that contain any-cased 'png' pattern.
|
apropos postscript | grep -i png
|
Searches the manual pages with descriptions in section 3, that name begins with lowercase letter.
|
apropos -s 3 . | grep ^[a-z]
|
Search the Movies folder in the user's home directory for files larger than 1024 megabytes in size.
|
find ~/Movies/ -size +1024M
|
search normal files called ' banckup ' from /usr directory downward and print them.
|
find /usr -type f -name backup -print
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.