nl
stringlengths 13
387
| bash
stringlengths 1
532
|
|---|---|
Search for all the directories in directories taken from the glob pattern '/path/to/folders/*' and add the extension ".mbox" to all and create directories named 'Messages' inside them
|
find /path/to/folders/* -type d -exec mv {} {}.mbox \; -exec mkdir {}.mbox/Messages \;
|
Search for all the directories named 'm?' under current directory tree, add the extension ".mbox" to all, create a 'Messages' directories inside them and move all files with .emlx extension to 'Messages' directory
|
find . -name 'm?' -type d -exec mv '{}' '{}.mbox' ';' -exec mkdir '{}.mbox/Messages' ';' -exec sh -c 'mv {}.mbox/*.emlx {}.mbox/Messages' ';'
|
Search for all directories named foo, FOO, or any other combination of uppercase and lowercase characters beneath the current directory.
|
find . -iname foo -type d
|
search for all empty directories in the folder /home
|
find /home -type d -empty
|
Search for all files and directories named foo, FOO, or any other combination of uppercase and lowercase characters beneath the current directory.
|
find . -iname foo
|
search for all files ending with ".mkv" in current folder
|
find /volume1/uploads -name "*.mkv"
|
search for all the files ending with "fits" in the folder "/store/01"
|
find /store/01 -name "*.fits"
|
search for all the files having spaces in the current folder and save the output to the variable founddata
|
founddata=`find . -name "filename including space" -print0`
|
Search for all files in the /home directory tree that have the same inode number
|
find /home -xdev -inum 2655341
|
Search for all files in the current directory recursively whose names begin with "Linkin Park"
|
find . -name "Linkin Park*"
|
Search for all files in the current directory recursively whose names contain "linkin", ignoring the case
|
find . -iname *linkin*
|
Search for all files in the current directory recursively whose names end with "Linkin Park"
|
find . -name "*Linkin Park"
|
search for all the files in the current directory which have been modified in the last 24 hours.
|
find . -mtime -1
|
search for all the files in the current directory which belong to the user "xuser1" and change the owner ship of them to "user2"
|
find . -user xuser1 -exec chown -R user2 {} \;
|
search for all the files in the current directory which have the group staff and have write permission enabled to the user and display them.
|
find . -group staff -perm -2000 -print
|
search for all the files in the current directory which have the name a.out or core or which end with .o and delete them.
|
find . \( -name a.out -o -name '*.o' -o -name 'core' \) -exec rm {} \;
|
search for all the files in the current directory which have size greater than 10KB (approx) and less than 32KB(approx).
|
find . -size +10000c -size -32000c -print
|
search for all the files in current folder and display all the file names separated by space
|
find . | paste -sd " "
|
search for all the files in the current folder and sort them in the order of their depth and display the file names
|
find -type d -printf '%d\t%P\n' | sort -r -nk1 | cut -f2-
|
search for all the files in the current folder which are bigger than 10KB and display them biggest file
|
find . -size +10k -exec ls -ls {} \+ | sort -n | tail -1
|
search for all the files in the current folder which have spaces and force delete them
|
find . -name "filename including space" -print0 | xargs -0 rm -rdf
|
search for all the files in current folder which start with "file2015-0" and move them to another folder
|
find . -name "file2015-0*" -exec mv {} .. \;
|
search for all the files in current folder which start with "file2015-0" and move them to frst 400 fiiles to another folder
|
find . -name "file2015-0*" | head -400 | xargs -I filename mv filename
|
search for all the files in the current folder which start with gen and end with bt2 and assign the output list to the variable var.
|
var="$(find . -name 'gen*.bt2')"
|
search for all the files in the folder /data/images which are modified after /tmp/foo
|
find /data/images -newer /tmp/foo
|
search for all the files in the folder /home which have sticky bit set and have the permissions 553
|
find /home -perm 1553
|
search for all the files in the folder /home/user1 which end with ".bin"
|
find /home/user1 -name "*.bin"
|
search for all the files in the folder /usr/bin which have not been accessed in the last 100*24 hours
|
find /usr/bin -type f -atime +100
|
Search for all the files in man pages and return the manual page for grep
|
find /usr/share/man/ -regex .*/grep*
|
Search for all files named foo, FOO, or any other combination of uppercase and lowercase characters beneath the current directory.
|
find . -iname foo -type f
|
Search for all files newer than file /tmp/t
|
find / -newer /tmp/t
|
Search for all files newer than file /tmp/t1 but not newer than file /tmp/t2
|
find / -newer /tmp/t1 -and -not -newer /tmp/t2
|
Search for all files not newer than file /tmp/t
|
find / -not -newer /tmp/t
|
Search for all files owned by user www-data that are not larger than 100kb
|
find -user www-data -not -size +100k
|
search for all the file sin the current folder which are bigger than 10KB and display them smallest file
|
find . -size +10k -exec ls -lS {} \+ | head -1
|
Search for all files that end in ".conf"
|
find / -type f -name "*.conf"
|
search for all the files which have not been modified in the last 6 months (180 days) in current folder and display the disk usage of them
|
find . -mtime +180 -exec du -sh {} \;
|
Search for all files with either "sitesearch" or "demo" in their path names
|
find . -ipath '*sitesearch*' -ipath '*demo*'
|
Search for all files with either "sitesearch" or "demo" in their path names
|
find . -iregex '.*sitesearch.*' -iregex '.*demo.*'
|
Search for all files with either "sitesearch" or "demo" in their path names
|
find . | grep -i demo | grep -i sitesearch
|
searching for all files with the extension mp3
|
find / -name *.mp3
|
Search for all files with same inode NUM
|
find . -inum NUM
|
Search for all files with the same inode number 41525360
|
find . -follow -inum 41525360
|
search for all the foo.txt files in the current folder and move them to another location
|
find . -name foo.txt -print0 | xargs -0 -I{} mv {} /some/new/location/{}
|
search for all the jpg files in the folder "/mnt/hda1/zdjecia/test1/" and copy these files to the folder /mnt/hda1/test/<same name as the found file>
|
find /mnt/hda1/zdjecia/test1/ -iname “*.jpg” -type f -exec cp {} -rv /mnt/hda1/test{} ‘;’
|
Search for all jpg images on the system and archive them
|
find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz
|
search for all the mp3 files in the file system and move them to the folder /mnt/mp3
|
find / -iname "*.mp3" -exec mv {} /mnt/mp3 \;
|
search for all the mp3 files in the folder /home/you which have been accessed 24 ago
|
find /home/you -iname “*.mp3” -atime 01 -type -f
|
search for all mp3 files in the folder /home/you which have been accessed exactly 10*24 hours ago
|
find /home/you -iname "*.mp3" -atime 10 -type -f
|
search for all non empty regular/normal files in the current folder and empty them ie., delete the content not the file
|
find . -type f -maxdepth 1 -not -empty -print0 | xargs -0i cp /dev/null {}
|
Search for all non-hidden files
|
find . -name '*'
|
search for all the non-hidden files in the current directory and do not search in the subfolders and dispaly their name and size.
|
find . -maxdepth 1 -name '[!.]*' -printf 'Name: %16f Size: %6s\n'
|
search for all pdf files in the folder "/home/pdf" which have been accessed in the last 60*24 hours
|
find /home/you -iname "*.pdf" -atime -60 -type -f
|
search for all perl files in the folder /nas/projects/mgmt/scripts/perl which have been modified yesterday
|
find /nas/projects/mgmt/scripts/perl -mtime 1 -daystart -iname "*.pl"
|
search for all the php files in the folder "/home/mywebsite" which have been changed in the last 30*24 hours
|
find /home/mywebsite -type f -name "*.php" -ctime -30
|
search for all the regular/normal files in the /etc folder which have been modified in the last 24 hours
|
find /etc/ -type f -mtime -1
|
search for all regular files in the current directory which have the extension "c" or "asm"
|
find . -type f \( -iname "*.c" -or -iname "*.asm" \)
|
search for all regular/normal files in current folder and display all the files which contain 16 lines
|
find . -type f -print0 | xargs -0 grep -cH '.' | grep ':16$'
|
search for all the regular files in the current folder and display the contents
|
find . -type f -exec cat {} \;
|
search for all regular/normal files in the current folder and display the number of lines in the file
|
find . -type f -print | xargs -L1 wc -l
|
search for all regular/normal files in the current folder and display the number of lines in the file
|
find . -type f -print0 | xargs -0L1 wc -l
|
search for all the regular files that have been changed in the last 48 hours and sync these to another folder
|
find /my/source/directory -ctime -2 -type f -printf "%P\n" | xargs -IFILE rsync -avR /my/./source/directory/FILE /my/dest/directory/
|
search for all the regular/normal files with the name "access.log" in the folder /var/www which are bigger than 100MB
|
find /var/www -type f -name «access.log*» -size +100M
|
search for all the regular/normal mp3 files in the file system and move them to the folder /mnt/mp3
|
find / -iname "*.mp3" -type f -exec /bin/mv {} /mnt/mp3 \;
|
search for all the regular/normal mp3 files in the file system and move them to the folder /mnt/mp3
|
find / -iname "*.mp3" -type f -print0 | xargs -0 -I '{}' /bin/mv "{}" /mnt/mp3/
|
search for all the regular/normal mp3 files in the file system and move them to the folder /mnt/mp3
|
find / -iname "*.mp3" -type f | xargs -I '{}' mv {} /mnt/mp3
|
search for all the rpm files in the file system which reside in the same partition as that of the root
|
find / -xdev -name "*.rpm"
|
search for all Scala files under the current directory that contain the string null
|
find . -type f -name "*.scala" -exec grep -B5 -A10 'null' {} \;
|
search for all tar.gz compress files in the current folder
|
find -name *.tar.gz
|
search for all the text files and display the long listing of these files from that directory
|
find . -name "*.txt" -execdir ls -la {} ";"
|
search for all the text files in the folder /foo and delete them
|
find /foo/ -name "*.txt" -exec rm -v {} \;
|
search for all text files in the folder /home
|
find /home -name *.txt
|
search for all xml files in current folder and display them
|
find . -name "*.xml" -exec echo {} \;
|
Search for all zero-byte files and move them to the /tmp/zerobyte folder
|
find test -type f -size 0 -exec mv {} /tmp/zerobyte \;
|
Search for broken symlinks
|
find -L -type l
|
Search for the case insensitive pattern 'PATTERN' in all files under current directory tree and display the matched files
|
find . -print | xargs grep -l -i "PATTERN"
|
Search for case insensitive pattern 'search for me' in all files that match the name pattern '*.[!r]*' under current directory tree
|
find . -name "*.[!r]*" -exec grep -i -l "search for me" {} \;
|
Search for the case insensitive pattern 'search for me' in all files with '.p', '.w' and '.i' extension under current directory tree without descending into '.svn' and 'pdv' directories
|
find . \( \( -name .svn -o -name pdv \) -type d -prune \) -o \( -name '*.[pwi]' -type f -exec grep -i -l "search for me" {} + \)
|
Search for the case insensitive regex expanded by $2 in all files named $1 (to be expanded) under current directory
|
find . -name "$1" -type f -exec grep -i "$2" '{}' \;
|
Search for the case insensitive regex expanded by $2 in all files named $1 (to be expanded) under current directory
|
find . -name "$1" -type f -print0 | xargs -0 grep -i "$2"
|
Search for the case insensitive regex expanded by $2 in all files named $1 (to be expanded) under current directory
|
find . -name $1 -type f -exec grep -i $2 '{}' \;
|
Search for case-insensitive "string" in "log.tar.gz"
|
zcat log.tar.gz | grep -a -i "string"
|
(Linux specific) Search for command "tail" in the maps of the process with PID 2671
|
cat /proc/2671/maps | grep `which tail`
|
search for dbmsspool.sql file in the current folder
|
find . -print|grep ?i dbmspool.sql
|
search for the directory "config" in the current folder
|
find . -name config -type d
|
search for the directory "config" in the current folder and change directory to it
|
cd `find . -name "config"`
|
search for the directory "mysql" in the /etc folder
|
find /etc -name mysql -type d
|
search for the directory "mysql" in the entire file system
|
find / -name mysql -type d
|
search for the directory "ora10" in the entire file system
|
find / -type d -name "ora10"
|
search for the directory "uploads" in current folder and change the permission of the folder and all the files to 755
|
find . -type d -name 'uploads' -print0 | xargs -0 chmod -R 755
|
Search for directory foo ignoring case
|
find . -iname foo -type d
|
search for directories in the folder "test" which end have 5 digits as their name
|
find ./test -type d -name '[0-9][0-9][0-9][0-9][0-9]'
|
search for directories in the folder "test" which end with 5 digits using regular expressions
|
find ./test -regextype posix-egrep -type d -regex '.*/[0-9]{5}$'
|
search for the directory starting with "ora10" in the entire file system
|
find / -type d -name "ora10*"
|
search for the directory testdir in the folder /home
|
find /home -type d -name testdir
|
Search for directories that contain the phrase "foo" but do not end in ".bar"
|
find . -name '*foo*' ! -name '*.bar' -type d -print
|
Search for empty files
|
find . -size 0k
|
Search for ERROR in all btree*.c files under current directory
|
grep ERROR $(find . -type f -name 'btree*.c')
|
Search for the extended grep regex 'expr' in all files with '.c' and '.h' extension under current directory tree
|
find . -name '*.[ch]' | xargs grep -E 'expr'
|
Search for the extened regex 'expr' in all files with '.c' and '.h' extension under current directory tree
|
find . -name '*.[ch]' | xargs grep -E 'expr'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.