nl
stringlengths
13
387
bash
stringlengths
1
532
Find all *.tex files/directories in maximum 2 levels down the current directory
find . -maxdepth 2 -name '*.tex'
Find all *.tex regular files in maximum 2 levels down the current directory
find . -type f -maxdepth 2 -name "*.tex"
Find all *.tex regular files under current directory
find . -type f -name "*.tex"
Find all *.texi files in /usr/local/doc
find /usr/local/doc -name '*.texi'
Find all *.txt, *.html files under /basedir that match the case insensitive pattern *company* in their names
find /basedir/ \( -iname '*company*' -and \( -iname '*.txt' -or -iname '*.html' \) \) -print0
Find all *.txt and *.json files
find . -type f \( -name "*.txt" -o -name "*.json" \)
Find all *.txt and *.json files in current directory
find . -type f \( -name "*.txt" -o -name "*.json" \)
Find all *.txt files/directories under current directory
find -name '*.txt'
Find all *.txt files/directories under current directory
find -name \*.txt
Find all *.txt files/directories under current directory
find . -name "*.txt"
Find all *.txt files/directories under current directory
find . -name "*.txt" -print
Find all *.txt files/directories under current directory
find . -name '*.txt'
Find all *.txt files/directories under current directory
find . -name *.txt -print
Find all *.txt files/directories under current directory discarding 'Permission denied' errors
find . -name "*.txt" -print | grep -v 'Permission denied'
Find all *.txt files/directories under current directory terminating their names/paths with null character
find . -name '*.txt' -print0
Find all *.txt files/directories under your home directory
find ~ -name "*.txt" -print
Find all *.txt files/directories under your home directory
find ~/ -name '*.txt'
Find all the *.txt files in the current directory older than 48 hours
find . -maxdepth 1 -name '*.txt' -mtime +2
Find all *.txt file (case insensitive) in the entire system and copy them to /tmp/txt
find / -iname '*.txt' | xargs --replace=@ cp @ /tmp/txt
Find all *.txt (case insensitive) files of user root under / directory and show a few lines of output from the beginning
find / -user root -iname "*.txt" | head
Find all *.txt files of user Tecmint under /home directory
find /home -user tecmint -iname "*.txt"
Find all *.txt files that reside under and below /home/wsuNID/
find /home/wsuNID/ -name "*.txt"
Find all *.txt files under /foo and delete them
find /foo -name "*.txt" -delete
Find all *.txt files under /foo and print their total size
find /foo -name "*.txt" -exec du -hc {} + | tail -n1
Find all *.txt files under current directory and print their timestamps and paths
find . -name "*.txt" -printf "%T+ %p\n"
Find all *.txt files under current directory, change their permission to 666 and copy them to /dst/ directory
find . -name \*.txt -exec chmod 666 {} \; -exec cp {} /dst/ \;
Find all *.txt files under current directory that contains the regex 'pattern' and list them with their filenames and matches
find . -type f -name '*.txt' -exec egrep pattern {} /dev/null \;
Find all *.txt files under current directory with their timestamps and paths, sort them and print the last entry only
find . -name "*.txt" -printf "%T+ %p\n" | sort | tail -1
Find all *.xml files under current directory
find -name *.xml
Find all *.xml.bz2 files under current directory
find . -name \*.xml.bz2
Find all *.xml.bz2 files under current directory
find . | grep ".xml.bz2$"
Find all *1234.56789* files/directories under current directory
find . -name '*1234.56789*'
Find all *Company* files/directories under /root/of/where/files/are directory
find /root/of/where/files/are -name *Company*
Find all *FooBar* files/directories under current directory and copy them to ~/foo/bar
find -name '*FooBar*' -print0 | xargs -0 cp -t ~/foo/bar
Find all *FooBar* files/directories under current directory and copy them to ~/foo/bar
find . -name '*FooBar*' -exec cp -t ~/foobar -- {} +
Find all *blue* files/directories under /myfiles
find /myfiles -name '*blue*'
Find all *company* (case-insensitive) files/directories under /basedir with null character as the delimiter
find /basedir/ -iname '*company*' -print0
Find all *company* files/directories under /root/of/where/files/are directory
find /root/of/where/files/are -name *company*
Find all *conf* files recursively under current directory
find . -name *conf*
Find all *fink* files/directories in entire file system
find / -name "*fink*" -print
Find all *fink* files/directories in entire file system
find / \( -type f -or -type d \) -name \*fink\* -print
Find all *fink* files/directories under current directory
find . -name "*fink*" -print
Find all *foo files/directories under current directory
find . -name '*foo'
Find all *foo files/directories under current directory (error prone)
find . name *foo
Find all *fstab* files under and below /etc
find /etc -name *fstab*
Find all *gz files under asia and emea directory
find asia emea -type f -name "*gz"
Find all *shp* directories under current directory and move '*' (literal) file/directory inside those directories to shp_all
find . -name '*shp*' -execdir mv '{}/*' shp_all ';'
Find all *shp* directories under current directory and move all regular files inside those directories to ../shp_all/
mv $(find $(find . -name "*shp*" -printf "%h\n" | uniq) -type f) ../shp_all/
Find all *shp* files/directories under current directory and move them to ../shp_all/
find . -name "*shp*" -exec mv {} ../shp_all/ \;
Find all *~ files/directories under dir and print an rm command for each of them for deletion
find dir -name \*~ | xargs echo rm
Find all .* files excluding list_files (case insensitive) under current directory
find . -iname ".*" \! -iname 'list_files'
find all .bak files in or below the current directory and move them to ~/.old.files directory:
find . -name "*.sh" -print0 | xargs -0 -I {} mv {} ~/back.scripts
Find all .bak files starting from the current directory and delete them
find . -iname "*.bak" -type f -print | xargs /bin/rm -f
Find all .c and .h files in the current directory tree and search them for "expr"
find -name '*.[ch]' | xargs grep -E 'expr'
Find all .core files on the system starting from / and delete them
find / -name "*.core" -print -exec rm {} \;
Find all .core files on the system starting from / and delete them
find / -name "*.core" | xargs rm
Find all .gif and .jpg files in the /var/www directory tree
find /var/www -name *.gif -o -name *.jpg
Find all .gif files in the /var/www directory tree
find /var/www -name *.gif
Find all .gif files in the /var/www directory tree that are between 5 kB and 10 kB in size
find /var/www -name *.gif -size +5k -size -10k
Find all .gz archives in the current directory tree and check if they are valid
find "*.gz" -exec gunzip -vt "{}" +
Find all .gz archives in the current directory tree and check if they are valid
find . -name '*.gz' | xargs gunzip -vt
Find all .gz archives in the current directory tree and check if they are valid
find . -name *.gz -exec gunzip '{}' \;
Find all .java files under and below the current directory
find . -name '*.java'
Find all .java files under current directory
find . -print | grep '\.java'
Find all .java files whose name contains "Message"
find . -print | grep '.*Message.*\.java'
find all the .jpg files in / and copy them to the current folder.
find / -type f -name *.jpg -exec cp {} . \;
Find all .jpg files in the current directory and below.
find . -name “*.jpg”
Find all .less files in the current directory tree
find . -name *.less
Find all .mp3 files starting from the current directory
find . -type f -iname *.mp3
Find all .mp3 files starting from the current directory and delete them
find . -type f -iname *.mp3 -delete
Find all .mp3 files with more than 10MB and delete them
find / -type f -name *.mp3 -size +10M -exec rm {} \;
Find all .php files in all directory trees matching pattern `/srv/www/*/htdocs/system/application/' and search those files for string "debug ("
find /srv/www/*/htdocs/system/application/ -name "*.php" -exec grep "debug (" {} \; -print
Find all .php files in all directory trees matching pattern `/srv/www/*/htdocs/system/application/' and search those files for string "debug ("
find /srv/www/*/htdocs/system/application/ -name "*.php" -exec grep -H "debug (" {} +
Find all .php files in all directory trees matching pattern `/srv/www/*/htdocs/system/application/' and search those files for string "debug ("
find /srv/www/*/htdocs/system/application/ -name "*.php" -print0 | xargs -0 grep -H "debug ("
Find all .php files in the current directory tree
find . -type f -name "*.php"
Find all .php files starting from the root directory /
find / -name "*.php"
Find all .php files starting from the root directory and ignoring /media
find / -name "*.php" -print -o -path '/media' -prune
find all .pm, .pl files in /users/tom and search for multiple pattern in same files and display the matched file names
find /users/tom -name '*.p[lm]' -exec grep -l -- '->get(' {} + | xargs grep -l '#hyphenate'
Find all .rb files owned by root in the /apps/ folder and below that have been accessed in the last two minutes.
find /apps/ -user root -type f -amin -2 -name *.rb
Find all .rpm files and change their permissions to 755
find / -name *.rpm -exec chmod 755 '{}' \;
Find all .sh files in the current directory tree and remove them
find . -name "*.sh" -exec rm -rf '{}' \
Find all .sh files in the current directory tree and remove them
find . -name "*.sh" -print0 | xargs -0 rm -rf
Find all .sh files in the current directory tree and remove them
find . -name "*.sh"| xargs rm -rf
Find all .sh files in or below the current directory and move them to folder ~/back.scripts
find . -name "*.sh" -print0 | xargs -0 -I file mv file ~/back.scripts
Find all .sh files in or below the current directory and move them to folder ~/back.scripts
find . -name "*.sh" -print0 | xargs -0 -I {} mv {} ~/back.scripts
Find all .sql files in the current directory recursively and print their path names separated by zeroes
find . -name '*.sql' -print0
Find all .svn directories under current directory and delete them
find . -type d -name ".svn" -print | xargs rm -rf
Find all .tmp files under and below the /tmp/ directory and remove them
find /tmp -name "*.tmp"| xargs rm
Find all .txt files except README.txt
find . -type f -name "*.txt" ! -name README.txt -print
Find all .txt files in the /home/user directory tree and copy them to /home/backup
find /home/user -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents
Find all .txt files in the /home/user1 directory tree and copy them to /home/backup
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents
Find all .txt files in current directory and rename with .html .
find . -type f -name "*.txt" -exec mv {} `basename {} .html` .html \;
Find all .txt files in the dir/ directory tree and copy them along with times, permissions, and ownership to dir_txt/
find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents
Find all .txt files of user Tecmint under /home directory
find /home -user tecmint -iname "*.txt"
Find all .txt files under the current directory and below
find -name \*.txt
Find all .txt files under the current directory and below
find . -name "*.txt"
Find all .txt files under the current directory and below
find . -name '*.txt' -print0
Find all .zip files in the current directory tree
find . -depth -name *.zip
Find all .zip files starting from the current directory which are owned by user tommye
find . -type f -user tommye -iname "*.zip"
Find all /path/to/check/* regular files without descending into any directory
find /path/to/check/* -maxdepth 0 -type f