nl
stringlengths
13
387
bash
stringlengths
1
532
Find all regular files in the current directory tree that match pattern 'btree*.c'
find . -type f -name 'btree*.c'
Find all regular files in the current directory tree that do not contain a whitespace
find . -type f \( -exec grep -q '[[:space:]]' {} \; -o -print \)
Find all regular files in the current directory tree whose names end with ".DS_Store" and delete them
find . -type f -name '*.DS_Store' -ls -delete
find all the normal/regular files in the current directory which have been modified in the last 24 hours
find . -mtime -1 -type f -print
find all the regular files in the current directory which do not have a read permission
find -type f ! -perm -444
find all the regular/normal files in the current directory which do not have the extension comment and and redirect the output to /tmp/list
find . -type f \! -name "*.Z" \! -name ".comment" -print | tee -a /tmp/list
find all normal/regular files in current folder and display the total lines in them
find . -type f -exec wc -l {} +
find all normal/regular files in current folder and display the total lines in them
find . -type f -print0 | xargs -0 wc -l
find all the regular/normal files in the current folder and do not search in the sub directories
find . -maxdepth 1 -type f
find all the normal/regular files in current folder and search for a pattern
find . -type f -print0 | xargs -0 grep pattern
find all the regular files in current folder, that have been changed in the last 3 days and display last 5 files
find . -type f -ctime -3 | tail -n 5
find all regular/normal files in the current folder that have been modified in the last 120 hours
find -mtime -5 -type f -print
find all the normal/regualar files in the current folder which have a size of 10KB and display a long listing details of them.
find . -type f -size +10000 -exec ls -al {} \;
find all the normal/regular files in the current folder which are present in the pattern file "file_list.txt"
find . type f -print | fgrep -f file_list.txt
find all the normal/regular files in the current folder which have been accessed in the last 24 hours and display a long listing of them
find . -type f -atime -1 -exec ls -l {} \;
find all the normal/regular files in the current folder which have been modified in the last 24 hours and display a long listing of them
find . -type f -mtime -1 -exec ls -l {} \;
find all regular/normal files in current folder which have been modified in the last 60 minutes
find -type f -mtime -60
find all the normal/regular files in the current folder which have been modified in the last day and display a long listing of them
find . -type f -mtime -1 -daystart -exec ls -l {} \;
find all the regular/normal files in the current folder which belong to the group "flossblog"
find . -group flossblog -type f
find all the regular/normal files in the current folder which belong to the users with the user id's between 500 and 1000
find . -uid +500 -uid -1000 -type f
find all normal/regular files in current folder which end with "~" or which begin and end with "#" and and and delete them
find . -maxdepth 1 -type f -name '*~' -delete -or -name '#*#' -delete
find all normal/regular files in current folder which end with "~" or which begin and end with "#" and and move them to temp folder
find . -maxdepth 1 -type f -name '*~' -exec mv {} /tmp/ \; -or -name '#*#' -exec mv {} /tmp/ \;
find all the regular files in the current folder which start with a "some text"
find . -type f -name '*some text*'
find all regular/normal files in the current folder whose name has the word photo or picture and which have been modified in the last 30 minutes
find . \( -iname "*photo*" -or -name "*picture*" \) -and ! -type d -and -mmin -30
find all normal/regular files in the entire file system having the word "filename" in their name.
find / -type f -iname "filename"
Find all regular files in the entire filesystem that belong to the group 'users'
find / -type f -group users
find all the regular/normal files in the folder "myfiles" which have the permission 647.
find /myfiles -type f -perm -647
find all regular/normal files in the folder "myfiles" which have read and write permission to the other users
find /myfiles -type f -perm -o+rw
find all the normal/regular files in the folder "pathfolder" excluding all hidden files and display the count
find pathfolder -maxdepth 1 -type f -not -path '*/\.*' | wc -l
find all the normal/regular files in the folder "pathfolder" which are 2 levels deep, excluding all hidden files and display the count
find pathfolder -mindepth 2 -maxdepth 2 -type f -not -path '*/\.*' | wc -l
find all the regular/normal files in the folder /travelphotos which are bigger than 200KB and which do not have the word "2015" in their name
find /travelphotos -type f -size +200k -not -iname "*2015*"
find all the normal/regular files in the folder main-directory
find main-directory -type f
Find all regular files in the home directory tree that were modified in the last 24 hours
find ~ -type f -mtime 0
Find all regular files in minimum 1 level down the $dir directory
find "$dir" -mindepth 1 -type f
Find all regular files in the the user's home/mail directory and search for the word "Linux".
find ~/mail -type f | xargs grep "Linux"
Find all regular files matching the name pattern '*.?htm*' under '/srv/www' and '/var/html' directory tree
find /srv/www /var/html -name "*.?htm*" -type f
Find all regular files named 'Chapter1' under current directory tree
find . -name Chapter1 -type f -print
Find all regular files named 'Waldo' under 'Books' directory tree that is located in user's home directory
find ~/Books -type f -name Waldo
Find all regular files named 'Waldo' under ~/Books directory tree
find ~/Books -type f -name Waldo
Find all regular files named 'whatever' under current directory tree excluding all paths that contain any hidden directory
find . \( ! -regex '.*/\..*' \) -type f -name "whatever"
Find all regular files named postgis-2.0.0 under your home directory
find ~/ -type f -name "postgis-2.0.0"
Find all regular files newer than '/tmp/$$' (where $$ expands to current process id) under '/tmefndr/oravl01' directory tree
find /tmefndr/oravl01 -type f -newer /tmp/$$
Find all regular files on the system whose names are 'myfile'
find / -name myfile -type f -print
Find all regular files on the system whose size is greater than 20000k
find / -type f -size +20000k
Find all regular files or symlinks in the entire file system
find / -mount -depth \( -type f -o -type l \) -print
Find all regular files recursively in the current directory
find . -type f
Find all regular files residing in the current directory tree and search them for string "/bin/ksh"
find . -type f -print | xargs grep -i 'bin/ksh'
Find all regular files starting from / that have permissions 777
find / -type f -perm 0777
Find all regular files starting from the current directory
find . -type f
Find all regular files starting from level 3 of directory tree ~/container and move them one level up
find ~/container -mindepth 3 -type f -execdir mv "{}" $(dirname "{}")/.. \;
Find all regular files starting from level 3 of directory tree ~/container and move them one level up
find ~/container -mindepth 3 -type f -execdir mv "{}" ./.. \;
Find all regular files starting from level 3 of directory tree ~/container and move them to the current directory
find ~/container -mindepth 3 -type f -exec mv {} . \;
Find all regular files starting from level 3 of directory tree ~/container and move them to the current directory's parent
find ~/container -mindepth 3 -type f -exec mv {} .. \;
Find all regular files that contain 'linux' (case insensitive) in their names under '/root' directory tree
find /root -type f -iname "*linux*"
Find all regular files that reside in the current directory tree and were last modified 1 day ago
find . -type f -mtime 0
Find all regular files that reside in the current directory tree and were last modified at least 1 day ago
find . -type f -mtime +0
Find all regular files that reside in the current directory tree and were last modified more than 1 day ago
find . -type f -mtime +1
Find all regular files that reside in the current directory tree and were last modified more than 2 days ago
find . -type f -mtime +2
Find all regular files that reside in the current directory tree and were last modified more than 3 days ago
find . -type f -mtime +3
Find all regular files that reside in the current directory tree and were last modified more than 4 days ago
find . -type f -mtime +4
Find all regular files that reside in the current directory tree and were last modified more than 7 days ago
find . -type f -mtime +7
Find all regular files that start with stat
find . -type f –iname stat*
Find all regular files that were modified $FTIME days ago under current directory tree
find . -type f -mtime $FTIME
Find all regular files that were modified more than 60 days ago under '/path-to-directory' directory tree, sort them according to timestamp and print the filenames preceded with the timestamps
find /path-to-directory -type f -mtime +60 -printf "%T@ %p\n" | sort
Find all the regular files under $DIR directory tree which have been modified before the file $a excluding the file $a and delete them
find "$DIR" -type f \! -newer "$a" \! -samefile "$a" -delete
Find all the regular files under $DIR directory tree which have been modified before the file $a excluding the file $a and delete them
find "$DIR" -type f \! -newer "$a" \! -samefile "$a" -exec rm {} +
Find all regular files under $DIR directory tree whose paths match the regex ".*\.${TYPES_RE}" where ${TYPES_RE} expands as a variable
find ${DIR} -type f -regex ".*\.${TYPES_RE}"
Find all regular files under $DIR/tmp/daily/, sort them in reverse numerical order and copy the first two files to $DIR/tmp/weekly/
find $DIR/tmp/daily/ -type f -printf "%p\n" | sort -rn | head -n 2 | xargs -I{} cp {} $DIR/tmp/weekly/
Find all regular files under $DIRECTORY_TO_PROCESS matching the case insensitive regex ".*\.$FILES_TO_PROCES" where $FILES_TO_PROCES is a variable and not matching the name pattern '$find_excludes' where $find_excludes is another variable, then print the files with null delimiter instead of newline
find "$DIRECTORY_TO_PROCESS" -type f -iregex ".*\.$FILES_TO_PROCES" ! -name "$find_excludes" -print0
Find all regular files under $FOLDER directory tree that start with '".' and end with '"' in their names and were modified in less than $RETENTION days excluding the files whose contents match one of the regular expressions defined per line in file $SKIP_FILE
find ${FOLDER} -type f ! -name \".*\" -mtime -${RETENTION} | egrep -vf ${SKIP_FILE}
Find all regular files under $d directory tree and change their permissions to 777
find "$d/" -type f -print0 | xargs -0 chmod 777
Find all regular files under $dir
find $dir -type f
Find all regular files under $dir directory tree that are bigger than $size MB in size and print them along with their sizes in decreasing order of size
find $dir -type f -size +"$size"M -printf '%s %p\n' | sort -rn
Find all regular files under $somedir directory and print each of their paths after a string literal 'Found unexpected file '
find "$somedir" -type f -exec echo Found unexpected file {} \;
Find all regular files under ${path} without following symlinks
find ${path} -P -type f
Find all regular files under '/directory_path' directory tree that have been modified within the last day
find /directory_path -type f -mtime -1 -print
Find all regular files under '/home/john/scripts' directory tree excluding files with '.ksh' extension
find /home/john/scripts -type f -not -name "*.ksh" -print
Find all regular files undee '/usr/bin' directoryt tree that are less than 50 bytes in size
find /usr/bin -type f -size -50c
Find all regular files under '/usr/bin' directory tree that are less than 50 bytes in size
find /usr/bin -type f -size -50c
Find all the regular files under '/your/dir' directory tree which are bigger than 5 MB and display them in decreasing order of their sizes
find /your/dir -type f -size +5M -exec du -h '{}' + | sort -hr
Find all regular files under ./Desktop directory
find ./Desktop -type f
find all regular files under the /etc/sysconfig directory that were accessed in the last 30 minutes
find /etc/sysconfig -amin -30 -type f
Find all regular files under and below /home/admin/public_html/, and change their permissions to 644
find . /home/admin/public_html/ -type f -exec chmod 644 {} \;
Find all regular files under and below /home/user/demo/
find /home/user/demo -type f -print
Find all regular files under and below /root that match pattern "*linux*", case insensitive
find /root -type f -iname "*linux*"
Find all regular files under current directory
find . -depth -type f -print
Find all regular files under current directory
find . -type f
Find all regular files under current directory non-recursively that have execute permission set for all (user, group and other)
find . -maxdepth 1 -type f -perm -uga=x
Find all regular files under current directory tree containing 'some text' in their names without descending into hidden directories and excluding hidden files
find . -type d -path '*/\.*' -prune -o -not -name '.*' -type f -name '*some text*' -print
Find all regular files under current directory tree that contain 'some text' in their names excluding paths that contain dot files/directories
find . -not -path '*/\.*' -type f -name '*some text*'
Find all regular files under current directory tree that match the regex 'tgt/etc/*' in their paths
find . -type f -name \* | grep "tgt/etc/*"
Find all the regular files under current directory tree that have not been modified in the last 31 days and delete them
find . -type f -mtime +31 -print0 | xargs -0 -r rm -f
Find all regular files under current directory tree whose names end with 'cache' or 'xml' or 'html'
find . -type f \( -name "*cache" -o -name "*xml" -o -name "*html" \)
Find all regular files under current directory tree without descending into './dir1' (except './dir1/subdir1*' pattern) and './dir2' directories
find . \( -path './dir1/*' -and -not -path './dir1/subdir1*' -or -path './dir2' \) -prune -or -type f -print
Find all the regular files under directory 'dir1' that are at least N levels deep
find dir1 -mindepth N -type f
Find all regular files under test directory
find test -type f
find all the reglar files which ahve been changed in the last 5 minutes and do not search in the sub directories.
find /home/pankaj -maxdepth 1 -cmin -5 -type f
find all regular files which have been modified in the last 48 hours in home folder
find ~ -type f -mtime -2
find all regular/normal files which have cpp folder in their path
find . -type f -path "*/cpp/*"
Find all regular files whose names contain "@" in directory tree ~/$folder
find ~/$folder -name "*@*" -type f