nl
stringlengths
13
387
bash
stringlengths
1
532
Find all xml files under current directory
find . -name '*.xml'
Find all xml files under current directory and archive them to .bz2 archives
find -name \*.xml -print0 | xargs -0 -n 1 -P 3 bzip2
Find all xx* files/directories excluding 'xxx' files/directories under your home directory
find ~ -name 'xx*' -and -not -name 'xxx'
find all the zip files in the current folder
find . -type f -name '*.zip'
Find an inode and remove
find . -inum 968746 -exec rm -i {} \;
Find and the 5 largest regular files in the Downloads folder of tecmint's home directory and output the file sizes in bytes.
find /home/tecmint/Downloads/ -type f -printf "%s %p\n" | sort -rn | head -n 5
Find and compress all .pl files in the current directory tree
find . -name "*.pl" | xargs tar -zcf pl.tar.gz
Find and copy all log files in the current directory tree to /tmp/log-files
find . -name \*.log -print0 | xargs -I{} -0 cp -v {} /tmp/log-files
Find and delete all hard links in the /home directory to file1
find /home -xdev -samefile file1 -exec rm {} +
Find and delete all hard links in the /home directory to file1
find /home -xdev -samefile file1 -print0 | xargs -0 rm
Find and delete all hard links in the /home directory tree to file1
find /home -xdev -samefile file1 | xargs rm
Find and delete the file with inode number 1316256
find ./ -inum 1316256 -delete
find and image in current folder (case insensitive search)
find . -iname "Articles.jpg"
Find and list all files on your current directory and show a few lines of output from the beginning
find | head
Find and list all regular files
find . -type f -ls
Find and print the full pathname of all PDF files in the current directory and its sub-directories.
find . -name "*.pdf" -print
Find and print the names of all files found in the current directory and all of its sub-directories
find . -print
Find and print the names of all files found in the current directory and all of its sub-directories.
find .
Find and print the names of all files found in the current directory and all of its sub-directories.
find . -print
Find and remove zero bytes files from user's directories .
find /usr/* -size 0c -exec rm {} \;
Find and remove all .core files
find / -name "*.core" -print -exec rm {} \;
Find and remove all .core files
find / -name "*.core" | xargs rm
Find and remove all .mp3 regular files under the current directory and below
find . -type f -name "*.mp3" -exec rm -f {} \;
Find and remove all .txt regular files under the current directory and below
find . -type f -name "*.txt" -exec rm -f {} \;
Find and remove the file with inode number 782263 in the current directory tree
find . -inum 782263 -exec rm -i {} \;
Find and remove multiple *.mp3 files
find . -type f -name "*.mp3" -exec rm -f {} \;
Fiind and remove multiple files such as *.mp3 or *.txt
find . -type f -name "*.txt" -exec rm -f {} \;
Find and remove multiple files such as *.mp3 or *.txt
find . -type f -name "*.mp3" -exec rm -f {} \;
Find and show all files in the current directory tree that are exactly 2000 kB
find . -size 2000k
Find and show all files on the system that are larger than 900 MB
find / -size +900M
Find and uncompress all files in the current directory tree ending in ".csv.gz"
find . -name '*.csv.gz' -exec gzip -d {} \;
Find and uncompress all files in the current directory tree ending in ".csv.gz"
find . -name '*.csv.gz' -print0 | xargs -0 -n1 gzip -d
Find any files in the current directory and its sub-directories that were last accessed more than 7 days and are larger than 20480 blocks in size.
find . -atime +7 -size +20480 -print
Find any files in the current directory and its sub-directories that were last accessed more than 7 days or are larger than 20480 blocks in size.
find . -atime +7 -o -size +20480 -print
find any files in the current directory that begin with a number
find . -regex './[0-9].*' -print
find any files or directories called ".svn" under the current directory and run a recursive delete (without prompting) command on each one.
find . -iname .svn -exec bash -c 'rm -rf {}' \;
Find any file that has "disc" somewhere in its name in the current directory and all of its sub-directories.
find . -name *disc*
Find any hidden regular files in the current directory and its sub-directories that were modified after .cshrc was last modified.
find . -type f -name ".*" -newer .cshrc -print
Find apparent size of a target directory
du -hs /path/to/directory
find the biggest files only (but not directories)
find . -type f -exec du -Sh {} + | sort -rh | head -n 15
Find blabla* files under current directory
find . -depth -name "blabla*" -type f | xargs rm -f
Find broken links
find / -type l -print0 | xargs -0 file | grep broken
Find broken links using the file command on each symlinks in the system and searching for the keword 'broken' with grep
find / -type l -print0 | xargs -0 file | grep broken
Find broken symlinks
find ./ -follow -lname "*"
Find broken symlinks in current directory
find -L -type l
Find broken symlinks in current directory
find . -type l -xtype l
find case-insensitive StringBuffer in all *.java files
find . -type f -name "*.java" -exec grep -il string {} \;
find case-insentive example.com file, and whole dose not contain beta
find -iname example.com | grep -v beta
find case-insentive example.com file, omit ./beta path
find ./ -path ./beta/* -prune -o -iname example.com -print
This find command ignore the case when searching for file name , to ignore the case in this example all .py & .PY file will search
find . -type f -iname "*.py"
Find command will display top 10 Big files from current directory .
find . -type f -exec ls -s {} \; |sort -n -r |head
Find command will list of all files & directories from current directory , before listing echo command will display ' List of files & Directory '
find . -exec echo ' List of files & Direcoty' {} \;
Find the core files and remove them
find . -name “core” -exec rm -f {} \;
find the count of all the charcters of the list of regular files present in the current folder
find . -type f | xargs | wc -c
find the count of all the regular files in a directory
find /usr -type f | wc -l
find the count of text files that are present in the current working directory.
find . -maxdepth 1 -name \*.txt -print0 | grep -cz .
Find CSS files omitting results containing "CVS"
find . \! -path "*CVS*" -type f -name "*.css"
find CSS files, omitting results containing "CVS"
find . \! -path "*CVS*" -type f -name "*.css"
Find the current directory and all its subdirectories.
find . -type d
Find deb packages in the current directory recursively
find . -type f -and -iname "*.deb"
find the depth of all the files in current folder and display the depth and file name
find folder1/ -depth -type f -printf "%d\t%p\n"
Find directory "/some/dir" if it is empty
find /some/dir/ -maxdepth 0 -empty
Find directory "your/dir" if it is empty
find your/dir -prune -empty
Find directory "your/dir" if it is empty
find your/dir -prune -empty -type d
Find directories and regular files containing `blah' in their names modified less than 2 days ago, case insensitive
find . -iname '*blah*' \( -type d -o -type f \) -mtime -2
find dirctory files which modification time is 7 days ago
find . -mtime -7 -type d
Find directories in the current directory (no sub-directories) and print them appended with a string literal 'Directory: '
find . -maxdepth 1 -type d -print | xargs -I "^" echo Directory: "^"
Find directories in the current directory recursively that are not "executable" by all
find -type d ! -perm -111
Find directories in the current directory tree that were modified within the last 24 hours and move them to /path/to/target-dir
find . -depth -type d -mtime 0 -exec mv -t /path/to/target-dir {} +
Find directories in the current directory tree that were modified within the last 24 hours and move them to /path/to/target-dir
find . -type d -mtime -0 -exec mv -t /path/to/target-dir {} +
Find directories in the current directory tree that were modified within the last 24 hours and move them to /path/to/target-dir
find . -type d -mtime -0 -print0 | xargs -0 mv -t /path/to/target-dir
Find directories in the current directory tree that were modified within the last 24 hours and move them to /path/to/target-dir
find . -type d -mtime 0 -exec mv {} /path/to/target-dir \;
Find directories in the current directory tree whose names are 33 characters in length
find . -type d -name "?????????????????????????????????"
Find directories modified within the last 7 days
find . -mtime -7 -type d
Find directories named `build'
find . -type d -name build
Find directories named `doc' in /usr and below
find /usr -name doc -type d
Find directories named `doc' in /usr and below
find /usr \( -name doc -and -type d \)
Find directories named 'work' under '/usr/ports/' directory tree and remove them
find /usr/ports/ -name work -type d -print -exec rm -rf {} \;
find directory names starts with 'bar'
find . -path './bar*' -print
Find directories owned by user news with permissions 775
find / -user news -type d -perm 775 -print
Find directories starting from /TBD that were modified more than 1 day ago
find /TBD -mtime +1 -type d
Find directories that have "755" permissions and modify them to have "700" permissions
find . -type d -perm 755 -exec chmod 700 {} \;
Find directories that are directly under $workspace_ts directory (no-subdirectories) and were modified more than 30 days ago
find $workspace_ts -mindepth 1 -maxdepth 1 -type d -mtime +30 -print
Find directories that are directly under /home/user/workspace directory (no-subdirectories) and were modified more than 30 days ago and print a message saying that the directory wasn't modified during last 30 days
find /home/user/workspace -mindepth 1 -maxdepth 1 -type d -mtime +30 -execdir echo "It seems that {} wasn't modified during last 30 days" ';'
Find directories that are directly under /home/user/workspace directory (no-subdirectories) and were modified more than 30 days ago and print a message saying that the directory wasn't modified during last 30 days
find /home/user/workspace -mindepth 1 -maxdepth 1 -type d -mtime +30 -printf "\t- It seems that %p wasn't modified during last 30 day\n"
find directories that have been modified in the last seven days
find . -mtime -7 -type d
find directories under the $LOGDIR directory where there have been no modifications for 5 days and deletes them.
find $LOGDIR -type d -mtime +5 -exec rm -f {} \;
find directories under the $LOGDIR directory where there has been no modifications within the last 24 hours and compresses the files.
find $LOGDIR -type d -mtime +0 -exec compress -r {} \;
Find directories under maximum 1 level down the directory $dir with 100 permission that are owned by the user $username
find $dir -maxdepth 1 -type d -user $username -perm -100
find directory which case-insensitive name is foo in current directory.
find . -iname foo -type d
find directory which case-insensitive name is too in currect directory
find . -iname foo -type d
find directory which name is Cookbook under /users/al
find /users/al -name Cookbook -type d
Find the directories whose pathnames contain "New Parts" at level 3 of the current directory tree and create symlinks to them in /cygdrive/c/Views
find -mindepth 3 -maxdepth 3 -type d | grep "New Parts" | tr '\012' '\000' | xargs -0 ln -s -t /cygdrive/c/Views
Find disk usage of all files inside the directory
du -a
Find disk used space of only the target directory
du --max-depth=0 ./directory
Find the empty directories and files under current directory
find -empty
Find empty files/directories under test directory
find test -empty
Find empty files in the test directory
find test -empty
Find empty files under test directory
find test -empty
Find every file/directory under /var/spool that was modified more than 60 days ago.
find /var/spool -mtime +60