Forrest logo
back to context overview

find

List of commands for find:

  • find:ai:030ba find all directories in the current directory
    $ find . -type d
    try on your machine
    explain this command
  • find:ai:04b42 find sum of bytes of all files that are more than 180 days older and list them using ls
    $ find . -type f -mtime +180 -exec ls -l {} + | awk '{sum += $5} END {print sum}'
    try on your machine
    explain this command
  • find:ai:0d242 Find folder named 'ciconia' within the file system and output the location
    $ find / -name ciconia -type d 2>/dev/null
    try on your machine
    explain this command
  • find:ai:0fa36 copy all files ending with .mkv to parent path
    $ find /path/to/current/directory -type f -name '*.mkv' -exec cp {} .. \;
    try on your machine
    explain this command
  • find:ai:2c433 How to find very big files?
    $ find ${directory} -type f -size +100M
    try on your machine
    explain this command
  • find:ai:330b7 list all files under 1 kb in directory recursively
    $ find . -type f -size -1k
    try on your machine
    explain this command
  • find:ai:33256 how do i delete files older than a date
    $ find ${filename}s -type f ! -newermt yyyy-mm-dd -delete
    try on your machine
    explain this command
  • find:ai:3d4b0 find all directories only sort month date time
    $ find . -type d -exec stat --format='{"path": "%n", "modified": "%y"}' {} + | sort -k2
    try on your machine
    explain this command
  • find:ai:3e759 find . -maxdepth 1 -type d -ls | sort -k8M -k9n -k10n
    $ find . -maxdepth 1 -type d -ls | sort -k8M -k9n -k10n
    try on your machine
    explain this command
  • find:ai:55a96 how do I delete .sql files older than
    $ find ${filename}s -name '*.sql' -mtime +30 -exec rm {} \;
    try on your machine
    explain this command
  • find:ai:5e206 how do i rename folders and replace the word "Staffel" with "Season" in a directory recursively
    $ find ${directory} -type d -name '*Staffel*' -exec rename 's/Staffel/Season/' {} +
    try on your machine
    explain this command
  • find:ai:6dbf5 find all directories only
    $ find / -type d
    try on your machine
    explain this command
  • find:ai:73ada Recursively counts all files in the current directory and its subdirectories
    $ find . -type f | wc -l
    try on your machine
    explain this command
  • find:ai:77038 find . -maxdepth 1 -type d -ls | sort -k8M -k9n -k10n -k11Vf
    $ find . -maxdepth 1 -type d -ls | sort -k8M -k9n -k10n -k11Vf
    try on your machine
    explain this command
  • find:ai:78e0e delete all files recursively ending with .nfo in specific folder
    $ find /path/to/folder -type f -name '*.nfo' -delete
    try on your machine
    explain this command
  • find:ai:8c4e8 how do I search for a file with a particular string in the name
    $ find . -name '*{string}*'
    try on your machine
    explain this command
  • find:ai:8d223 Searches for a folder named 'ciconia' in the home directory
    $ find ~/ -type d -name ciconia
    try on your machine
    explain this command
  • find:ai:9afa9 delete all files ending with '.nfo' in a specific directory
    $ find ${directory} -type f -name '*.nfo' -delete
    try on your machine
    explain this command
  • find:ai:abbe7 Rename all files in current directory to max 20 characters
    $ find . -maxdepth 1 -type f -exec sh -c 'mv "$1" "${1:0:20}"' _ {} \;
    try on your machine
    explain this command
  • find:ai:b6911 how do I recursively search a path and only show the most recently modified file with a timestamp?
    $ find /your/path -type f -printf '%T@ %p
    $ ' | sort -n | tail -n 1 | awk '{print $2}'
    try on your machine
    explain this command
  • find:ai:b7e66 Searches for a file named 'wp-setting.php' in the entire file system
    $ find / -name wp-setting.php
    try on your machine
    explain this command
  • find:ai:bc3a9 how do I delete files older than
    $ find ${filename}s -type f -mtime +7 -exec rm {} \;
    try on your machine
    explain this command
  • find:ai:bf859 zip excluding all files with recurring name in subdirectories
    $ find ${directory} -type f -not -path '*/recurring_name/*' -exec zip archive.zip {} +
    try on your machine
    explain this command
  • find:ai:c0495 find all directories only sort month
    $ find . -maxdepth 1 -type d -printf '%TY-%Tm\t%p\n' | sort -k1,1n -k2,2n | cut -f2-
    try on your machine
    explain this command
  • find:ai:cc3e0 How to delete all files bigger than 10 mb?
    $ find . -type f -size +10M -delete
    try on your machine
    explain this command
  • find:ai:d6a87 find all files with 0 bytes in all folder and subfolders
    $ find . -type f -size 0 -exec ls -l {} \; -exec echo {} \;
    try on your machine
    explain this command
  • find:ai:dc91a find sum of bytes in GB of all files that are more than 180 days older and list them using ls
    $ find ${directory} -type f -mtime +180 -ls | awk '{SUM += $7} END {print SUM/1024/1024/1024}' | jq -R .
    try on your machine
    explain this command
  • find:ai:dd0b8 delete .sql files older than 1 week
    $ find ${filename}s -name '*.sql' -type f -mtime +7 -delete
    try on your machine
    explain this command
  • find:ai:e174d how do i rename all folders and replace the word "Staffel" with "Season" in a directory recursively
    $ find ${directory} -depth -type d -execdir rename 's/Staffel/Season/' {} +
    try on your machine
    explain this command
  • find:ai:e4788 Searches all subdirectories starting from root for a file called .startup
    $ find / -name .startup
    try on your machine
    explain this command
  • find:ai:e71fc Recursively finds all files ending with .mkv and moves them to specified path.
    $ find /path/to/start -type f -name '*.mkv' -exec mv {} /destination/path \;
    try on your machine
    explain this command
  • find:ai:e7406 cat all files named status recursively
    $ find . -type f -name 'status' -exec cat {} \;
    try on your machine
    explain this command
  • find:ai:f5504 find all files that are more than 180 days older and list them using ls
    $ find . -type f -mtime +180 -exec ls -l {} \;
    try on your machine
    explain this command
  • find:ai:f648b How to find all files that contain "text" in the filename
    $ find /path/to/search -type f -name '*text*'
    try on your machine
    explain this command
  • find:ai:fcb96 search sub directories for file called .startup
    $ find ${directory} -type f -name .startup
    try on your machine
    explain this command
  • find:tldr:0bc58 find: Find files matching multiple path/name patterns.
    $ find ${root_path} -path '${**-path-**-*-ext}' -or -name '${*pattern*}'
    try on your machine
    explain this command
  • find:tldr:1d82c find: Run a command for each file (use `{}` within the command to access the filename).
    $ find ${root_path} -name '${*-ext}' -exec ${wc -l {} }\;
    try on your machine
    explain this command
  • find:tldr:1e3af find: Find files matching a given pattern, excluding specific paths.
    $ find ${root_path} -name '${*-py}' -not -path '${*-site-packages-*}'
    try on your machine
    explain this command
  • find:tldr:35c1a find: Find files matching a given size range, limiting the recursive depth to "1":.
    $ find ${root_path} -maxdepth 1 -size ${+500k} -size ${-10M}
    try on your machine
    explain this command
  • find:tldr:4b725 find: Display lines that do not contain the specified string.
    $ find "${string}" ${path\to\file_or_directory} /v
    try on your machine
    explain this command
  • find:tldr:4fca5 find: Display line numbers with the list of lines.
    $ find "${string}" ${path\to\file_or_directory} /n
    try on your machine
    explain this command
  • find:tldr:8efff find: Find empty (0 byte) files and delete them.
    $ find ${root_path} -type ${f} -empty -delete
    try on your machine
    explain this command
  • find:tldr:9da7a find: Find files modified in the last 7 days.
    $ find ${root_path} -daystart -mtime -${7}
    try on your machine
    explain this command
  • find:tldr:b06eb find: Find lines that contain a specified string.
    $ find "${string}" ${path\to\file_or_directory}
    try on your machine
    explain this command
  • find:tldr:d74c9 find: Find directories matching a given name, in case-insensitive mode.
    $ find ${root_path} -type d -iname '${*lib*}'
    try on your machine
    explain this command
  • find:tldr:e5430 find: Display the count of lines that contain the specified string.
    $ find "${string}" ${path\to\file_or_directory} /c
    try on your machine
    explain this command
back to context overview