nl
stringlengths
13
387
bash
stringlengths
1
532
Find all regular files whose names contain "@" in directory tree ~/$folder
find ~/$folder -name "*@*" -type f -print0
Find all regular files whose names do not end in "*.html"
find . -type f -not -name "*.html"
Find all regular files with '.jpg' (case insensitive) extension, sort them by name, print the output and also save the list to file 'file_list.txt'
find . -type f|grep -i "\.jpg$" |sort| tee file_list.txt
Find all regular files with '.r' and '.c' in their names under current directory tree
find ./ -type f \( -name '*.r*' -o -name '*.c*' \) -print
Find all the regular files with '.tgz' and '.gz' extensions and delete the oldest file under '/home/backups' directory tree
find /home/backups -type f \( -name \*.tgz -o -name \*.gz \) -print0 | xargs -0 ls -t | tail -1 | xargs rm
Find all regular files with '.what_to_find' extension in the entire filesystem and move them to directory '/new_directory'
find / -iname "*.what_to_find" -type f -exec mv {} /new_directory \;
Find all regular files with 400 permission under '/data' directory tree
find /data -type f -perm 400 -print
Find all regular files with the group read permission set in your home directory and below and output detailed information about each file.
find . -perm -g=r -type f -exec ls -l {} \;
Find all regular files with name pattern $filename under $fileloc directory tree
find "$fileloc" -type f -prune -name "$filename" -print
Find all regular files with permissions 777 under and below /home/user/demo/
find /home/user/demo -type f -perm 777 -print
Find all regular files with permissions 777 under and below /home/user/demo/, and change their permissions to 755
find /home/user/demo -type f -perm 777 -print -exec chmod 755 {} \;
Find all regular files with space in their names under current directory and rename them by replacing all spaces with _
find -name "* *" -type f | rename 's/ /_/g'
Find all regular non-hidden files in the current directory and its subdirectories
find . -not -path '*/\.*' -type f \( ! -iname ".*" \)
Find all sample* files/directories under current directory and print 'program {}-out {}' where {} will expand to file paths
find . -name "sample*" | xargs -i echo program {}-out {}
Find all sample*_1.txt files/directories under current directory
find . -name "sample*_1.txt"
Find all the SGID bit files under current directory whose permissions set to 644 and show a few lines of output from the beginning
find . -perm 0644 | head
Find all the SGID bit files whose permissions set to 644
find / -perm 2644
Find all the SGID files in the current directory tree
find . -perm /g+s
Find all SGID set files
find / -perm /g=s
Find all SGID set files in the file system
find / -perm /g=s
Find all SGID set files under current directory and show a few lines of output from the beginning
find . -perm /g+s | head
find all the shell scripts or perl files in the current directory
find . -type f \( -name "*.sh" -o -name "*.pl" \)
find all sqlite files in the current directory.
find ./ -name "*.sqlite"
Find all the Sticky Bit set files in entire file system whose permission are 551
find / -perm 0551
Find all the Sticky Bit set files whose permission are 551
find / -perm 1551
Find all strings matching pattern "^${KEY}${DELIMITER}" in $FILE file and print rest of string after $DELIMITER
cat "$FILE" | grep "^${KEY}${DELIMITER}" | cut -f2- -d"$DELIMITER"
Finds all strings with parent folder of path '$path' in 'file', and saves result in 'x' variable.
x=$(grep "$(dirname "$path")" file)
Find all subdirectories of the current directory except hidden ones
find -maxdepth 1 -type d ! -name ".*"
Find all SUID files .
find / -perm /u=s
Find all the SUID files in the current directory tree
find . -perm /u=s
Find all SUID files in entire file system
find / -perm +4000
Find all SUID files in entire file system
find / -perm +u=s
Find all SUID set files
find / -perm /u=s
Find all SUID set files in the file system
find / -perm /u=s
find all the swap files (files ending with ~) in the current folder and delete them
find . -name "*~" -delete
find all the swap files (files ending with ~) in the current folder and delete them
find . -name "*~" -exec rm {} \;
Find all symbolic links containing 'javaplugin' in their names under '/usr' directory tree
find /usr/ -lname *javaplugin*
Find all symbolic links containing 'vim' in their names uder '/usr/bin' directory tree
find /usr/bin -name '*vim*' -type l
find all symbolic links in the current folder
find -type l
find all the symbolic links in the current folder
find /etc -type l -print
find all the symbolic links in the current folder and check the file type and display the output of those files which are broken
find ./ -type l -exec file {} \; |grep broken
find all the symbolic links in the current folder and follow to the original file
find -L . -type l
find all the symbolic links in the current folder and follow to the pointing file
find -L
find all the symbolic links in the current folder that are broken
find . -xtype l
Find all symbolic links starting from the current directory and list them
find . -type l -ls
Find all symbolic links under '/proc/$pid/fd' directory tree with name pattern '$save_path/sess_\*' and update their timestamps
find "/proc/$pid/fd" -ignore_readdir_race -lname "$save_path/sess_\*" -exec touch -c {}
Find all symbolic links under '/some/directory' driectory tree
find /some/directory -type l -print
Find all symbolic links under '/some/directory' tree
find /some/directory -type l -print
find all symbolic links under /usr
find /usr -type l
Find all symbolic links under current directory that are not hard links
find . -type f -links 1 -print
Find all symbolic links under the current folder and below
find –L –xtype l
Find all symlinks in the /myfiles directory tree
find /myfiles -type l
Find all symlinks under /myfiles directory
find /myfiles -type l
Find all symlinks under current directory
find . -type l
Find all symlinks under current directory
find ./ -type l
Find all syslog directories under /var/log directory
find /var/log -name "syslog" -type d
Find all target files outside the current working directory with symbolic links in the current working directory
find . -type l -exec readlink -f '{}' \; | grep -v "^`readlink -f ${PWD}`"
find all teh script files in a directory
find /home/john -name "*.sh" -type f -print
Find all test.txt files/directories under current directory
find . -name test.txt
Find all test1.h files under current directory
sudo find . -name test1.h
Find all test2.h files under current directory
sudo find . -name test2.h
Find all your text files
find . -name "*.txt" -print
find all text files in the current directory
find . -name "*.txt" -print
find all text files in the current directory and compress them to a cpio file
find . -name '*.txt' | cpio -pdm /path/to/destdir
find all text files in the current directory and display them page wise
find . -name "*.txt" -print
find all the text files in the current directory which have been modified in the last 4 days and not today and copy them to another folder
find . -name "*.txt" -type f -daystart -mtime -4 -mtime +0|xargs -i cp {} /home/ozuma/tmp
find all text files in current folder and delete them
find . -name ".txt" -exec rm "{}" \;
find all text files in current folder and display all files that have the alphabet a in their name
find . -name ".txt" | grep a
find all the text files in the current folder and display their Permissions and size along with their name
find . -name "*.txt" -printf "%M %f \t %s bytes \t%y\n"
find all the text files in current folder and force delete them
find . -name "*.txt" | xargs rm -rf
find all the text files in the current folder and do not search in somedir, bin directories
find . -name somedir -prune , -name bin -prune -o -name "*.txt" -print
find all the text files in the current folder and do not search in somedir, bin directories
find . \( -name somedir -prune \) , \( -name bin -prune \) -o \( -name "*.txt" -print \)
find all the text files in the current folder and do not search in the sub directories
find -maxdepth 1 -iname "*.txt"
find all text files in the current folder excluding those that are presenti n the folder "/svn" and search for a pattern.
find . -name '*.txt' \! -wholename '*/.svn/*' -exec grep 'sometext' '{}' \; -print
find all the text files in the current folder expect those which are in the path "sk"
find . -path "./sk" -prune -o -name "*.txt" -print
find all the text files in the current folder starting with "somefiles-"
find . -name "somefiles-*-.txt" -type f
find all text files in the current folder which have been modified after the file /tmp/newerthan
find . -name "*.txt" -newer /tmp/newerthan
find all text files in current folder; which have been modified exactly 5 days ago
find . –name "*.txt" –mtime 5
find all the text files in the entire filesystem which belong to the user root and display the ten files.
find / -user root -iname "*.txt" | head
find all text files in the folder "FFF" and find the md5sum for them
find FFF -name "*.txt" -exec md5sum '{}' \;
find all the text files in the folder /home/calvin and do not search beyond 2 levels
find /home/calvin/ -maxdepth 2 -name “*.txt”
find all the text files in the folder /home/calvin which are atleast below 2 levels
find /home/calvin/ -mindepth 2 -name “*.txt”
find all the text files in the home folder
find ~ -name "*.txt" — print
find all text files in user/directory/ which have been modified today and display the last line of these files
find /user/directory/ -name "*txt" -mtime 0 -type f -printf '%p: ' -exec tail -1 {} \;
find all the text files present in the current directory excluding the search in certain paths.
find . -type f -name "*.txt" ! -path "./Movies/*" ! -path "./Downloads/*" ! -path "./Music/*"
find all the text files which are present in the current directory excludinghidden files.
find . -type f \( -iname "*.txt" ! -iname ".*" \)
find all text files which have extra extensions in the current folder
find . -name '*.text' -exec $SHELL -c '[ ! -f ${1%.*} ]' $SHELL '{}' ';' -print
find all tools generated files a.out , *.o and core dump files which not required to us these all junk files & delete from current directory .
find . \( -name a.out -o -name '*.' -o -name 'core' \) -exec rm {} \;
Find all top-level files in the current folder but ones with name like '*Music*' to the 'dest/' folder.
find . -maxdepth 1 -name '*Music*' -prune -o -print0 | xargs -0 -i cp {} dest/
Find all TXT files in the current directory and copy them to directory "$HOME/newdir"
find "$HOME" -name '*.txt' -type f -not -path "$HOME/newdir/*" -print0 | xargs -0 cp -t "$HOME/newdir"
Find all TXT files in the current directory and copy them to directory "$HOME/newdir"
find "$HOME" -name '*.txt' -type f -print0 | sort -zu | xargs -0 cp -t "$HOME/newdir"
Find all TXT files in the current directory and copy them to directory "$HOME/newdir"
find "$HOME" -name '*.txt' -type f -print0 | xargs -0 cp -ut "$HOME/newdir"
Find all TXT files on the system and copy them to /tmp/txt
find / -iname '*.txt' | xargs --replace=@ cp @ /tmp/txt
find all the undo files in the current folder and display the toal lines, words, characters
find ./ -name *.undo | xargs wc
Finds all users logged in via ssh.
w | grep ssh
find all the video files in the home folder
find ~ -type f -exec file -i {} + | grep video
find all the word press configuration php files in the folder /var/www
find /var/www/ -name wp-config.php
find all the word press configuration php files in the folder /var/www and do not search beyond two levels
find /var/www/ -name wp-config.php -maxdepth 2
find all the xml files in current folder and which are present in the pattern list file "/tmp/a"
find . -name "*.xml" -exec grep -HFf /tmp/a {} \;
find all the xml files in the current folder except those that are present in the workspace folder and create a tarball of these files
find . -name \*.xml | grep -v /workspace/ | tr '\n' '\0' | xargs -0 tar -cf xml.tar