Cheatsheets
HomeWriteupsResourcesCheatsheets
Linux
Linux
  • Know Yourself and Your System
    • id
    • logname
    • uname
    • w
    • who
    • whoami
  • Surfing / Knowing Your File System
    • cd
    • df
    • du
    • ls
    • pwd
    • stat
    • tree
  • Knowing About Files / Commands
    • alias
    • file
    • info
    • whatis
    • apropos
    • man
    • help
    • history
    • script
  • Manipulating Files / Directories
    • touch
    • mkdir
    • rm
    • rmdir
    • cp
    • mv
    • ln
  • Interacting with Files
    • cat
    • head
    • less
    • middle
    • more
    • tail
  • STROPS / Text Manipulation
    • awk
    • cut
    • grep
    • jq
    • join
    • paste
    • sed
    • sort
    • tr
    • uniq
    • xargs
    • xclip
    • wc
    • tee
    • echo
    • comm
    • diff
    • patch
    • aspell
    • Combos
  • Formatting the Output
    • nl
    • fold
    • fmt
    • pr
    • printf
  • Searching / Finding
    • find
    • locate
    • which
    • whereis
    • type
  • Web Interaction
    • curl
    • wget
  • xxd
  • References
Powered by GitBook
On this page
  • Introduction
  • Syntax
  • Important Flags
  • Examples

Was this helpful?

  1. Searching / Finding

find

find linux command cheatsheet by Thamizhiniyan C S

Introduction

The find command is used to search for files in a directory hierarchy.


Syntax

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression]


Important Flags

Flag
Description

-H

Follow symbolic links on command line only.

-L

Follow all symbolic links.

-P

Never follow symbolic links.

-D

Process debugging option.

-name

Matches files/directories by name.

-type

Matches files by type.

-perm

Matches files by permission.

-user

Matches files by owner.

-mtime

Matches files by modification time.

-atime

Matches files by access time.

-cmin

Matches files by changed minutes ago.

-amin

Matches files by accessed minutes ago.

-size

Matches files by size.

-writable

Matches files that are writable.


Examples

Command
Description

Read the manual for the find command

find the file named “flag1.txt” in the current directory

find the file names “flag1.txt” in the /home directory

find the directory named config under “/”

find files with the 777 permissions (files readable, writable, and executable by all users)

find executable files

find all files for user “frank” under “/home”

find files that were modified in the last 10 days

find files that were accessed in the last 10 day

find files changed within the last hour (60 minutes)

find files accesses within the last hour (60 minutes)

find files with a 50 MB size

find files that are larger than 100 MB

redirect errors to “/dev/null” and have a cleaner output

Find world-writeable folders

Find world-writeable folders

Find world-writeable folders

Find world-executable folders

Find files/directories named "gcc*"

Find files with setuid, suppress errors

Find setuid files, suppress errors

Find files with the SUID bit

Find files with the SUID bit

Find files based on date accessed

Find files based on date modified

Find files modified after a specific date

Find files based on group name

To perform the search and locate the links that do not work (Find Broken Symbolic Links)

PreviousprintfNextlocate

Last updated 11 months ago

Was this helpful?

man find
find . -name flag1.txt
find /home -name flag1.txt
find / -type d -name config
find / -type f -perm 0777
find / -perm a=x
find /home -user frank
find / -mtime 10
find / -atime 10
find / -cmin -60
find / -amin -60
find / -size 50M
find / -size +100M
find / -size +100M -type f 2>/dev/null
find / -writable -type d 2>/dev/null
find / -perm -222 -type d 2>/dev/null
find / -perm -o w -type d 2>/dev/null
find / -perm -o x -type d 2>/dev/null
find / -name perl*
find / -name python*
find / -name gcc*
find / -perm -u=s -type f 2>/dev/null
find / -perm -4000 2>/dev/null
find [directory path] -type f -newerat [start date range] ! -newerat [end date range]
find [directory path] -type f -newermt [start date range] ! -newermt [end date range]
find [directory path] -type f -newermt '[date and time]'
find [directory path] -type f -group [group name]
find [directory] -type l ! -exec test -e {} \; -print