Hackbydoing Academy tool guide · Linux command line essentials · free, no login
find walks through folders and finds files that match tests you give it — by name, type, age or permissions — and can then list, print or act on what it finds.
find / -perm -4000 -type f 2>/dev/null
It searches the whole disk for regular files carrying the setuid permission bit — programs that run with their owner's powers — and hides the permission-error noise.
| -1 | Not a flag on its own: this is the value that follows -mtime in 'find . -type f -mtime -1', meaning 'changed less than 1 day (24 hours) ago' — the minus sign means 'less than'. |
| -4000 | Not a flag on its own: this is the value that follows -perm in 'find / -perm -4000'. 4000 is the setuid bit, and the leading minus means 'files that have this bit set' — programs that run with the file owner's powers, which is why defenders hunt them. |
| -delete | An action: delete every file and empty folder find matches. Powerful and unforgiving — there is no undo and no trash bin, so pros always run the same find without -delete first to see exactly what would go. |
| -exec | Run a command on every file find matches: the pieces after -exec are the command to run, {} stands for 'the file found', and the command must end with \; (one file at a time) or + (batched). Example: -exec ls -l {} \; |
| -l | Not a find flag at all: in the academy's example 'find ~ -name "*.tmp" -exec ls -l {} \;' the -l belongs to the ls command that -exec runs — it is ls's long-format switch, applied to each file find hands over. |
| -ls | An action, not a test: print each match in a detailed ls-style listing (with its inode number, size, permissions, owner and date) instead of just its path. |
| -mtime | Test by modification age, in whole days: the next piece is its value, a number — plain 7 means exactly 7 days ago, +7 means more than 7 days ago, -7 means less than 7 days ago. |
| -name | Test by name: the next piece is its value, a name pattern in quotes like "*.log", where * means 'any characters' — so this matches every file whose name ends in .log. |
| -perm | Test by permissions: the next piece is its value, the permission bits to check, written in octal numbers like 4000. A minus sign in front of the value means 'all of these bits must be set'. |
| -type | Test by kind: the next piece is its value, a single letter — f for a regular file, d for a directory (folder), l for a link. |
| -xdev | Stay on one filesystem: do not cross over into other mounted disks or partitions while searching, so a sweep of / stays on the system disk only. |
Only run find on systems you own or have explicit, written permission to test — at work that means a signed engagement, at home that means your own lab. Inside Hackbydoing Academy you practice on simulated networks and lab machines built for exactly this, where breaking things is the lesson and no one else's systems are involved. Learning how a tool works also teaches you what it looks like from the defender's chair: the logs it leaves, the traffic it makes, and the settings that shut it down.
Reading about find is step one. In the Academy you run it yourself, step by step, in guided labs on simulated networks — 185 rooms covering attack and defense, from your first scan to full operations, with a defender's debrief at the end of every room. Founding membership is $9.99/mo for the first 500 members.
Join Hackbydoing Academy →Free from the Hackbydoing Academy — learn cybersecurity by doing: real tools, guided labs, attack and defense, on simulated networks. More free material: Tool Guides index · Free Downloads Library · Hackbydoing Academy · Print this page (Ctrl/Cmd+P) for a clean paper copy.