find command
The find command, which walks a directory tree and prints, or acts on, every entry that passes its tests.
In more detail
Tests such as -name, -type, -size, -mtime and -perm select entries, and -maxdepth limits how deep it goes. It prints results in the order it meets them, so sort the output when order matters. Quote patterns given to -name so find, not the shell, expands them.
Examples
find notes -name "*.md" -not -path "*archive*"find dist -type f | sortfind environments -mindepth 1 -maxdepth 2 -type d | sortRelated terms
- find test — An option to find that checks each entry, such as -name, -type f or -mtime, keeping only entries for which it is true.
- -exec — The find action that runs a command on the entries it finds, with {} standing for each file name.
- xargs — The command that reads items from its standard input and runs another command with them as arguments, in batches.
- -print0 — The find action that ends each file name with a null byte instead of a newline, for use with xargs -0.
- dist directory — The conventional folder, short for distribution, where a build puts the finished files that will be shipped.
Taught in
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Permissions And Ownership — Bash Scripting & Command Line Automation
- find And xargs — Bash Scripting & Command Line Automation
- Archives, Transfers And The Network — Bash Scripting & Command Line Automation
- Scheduling, Monitoring And A Script That Reports — Bash Scripting & Command Line Automation
- Passing Data Between Jobs: Artifacts — Continuous Integration & Continuous Delivery Pipelines
- Repository Layout for Environments — Continuous Integration & Continuous Delivery Pipelines