Editing Find
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | <code>[[w:find (Unix)|find]]</code><ref>http://man7.org/linux/man-pages/man1/find.1.html</ref> is a command-line utility that searches for files in one or more directory trees of a file system. Available in Linux, included in <code>findutils</code> packages, and in Windows ([[w:Find_(Windows)]]). | |
− | <code>[[ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Linux Example commands == | == Linux Example commands == | ||
* Search files between a size range: | * Search files between a size range: | ||
− | ** <code> | + | ** <code>find . -size +10G</code> |
** <code>find . -size +100k -a -size -500k</code> | ** <code>find . -size +100k -a -size -500k</code> | ||
* Search empty files: <code>find . -size 0k</code> | * Search empty files: <code>find . -size 0k</code> | ||
* Search non-empty files: <code>find . ! -size 0k</code> | * Search non-empty files: <code>find . ! -size 0k</code> | ||
* One line listing with sizes using ls and find: <code>[[linux/Basic commands/ls|ls]] -ldh $(find /path/to/search/)</code> | * One line listing with sizes using ls and find: <code>[[linux/Basic commands/ls|ls]] -ldh $(find /path/to/search/)</code> | ||
− | * One line filename and directory listing with full path: <code> | + | * One line filename and directory listing with full path: <code>find . -name "*"</code> |
* One line filename and NOT directory . listing with full path: <code>find . -type f -exec ls \{\} \;</code> | * One line filename and NOT directory . listing with full path: <code>find . -type f -exec ls \{\} \;</code> | ||
− | |||
− | |||
* Search for [[hard links]]: <code>find /path/to/search -samefile /path/to/your/file</code><ref>https://www.cyberciti.biz/faq/how-to-find-all-hard-links-in-a-directory-on-linux/</ref> (See also: <code>stat</code>) | * Search for [[hard links]]: <code>find /path/to/search -samefile /path/to/your/file</code><ref>https://www.cyberciti.biz/faq/how-to-find-all-hard-links-in-a-directory-on-linux/</ref> (See also: <code>stat</code>) | ||
* Order by size: | * Order by size: | ||
− | ** <code>find . -type f | + | ** <code>find . -type f -ls | sort -rnk7 | more</code> |
− | |||
** <code>find . -ls 2>&1 | sort -rnk7 | more</code> | ** <code>find . -ls 2>&1 | sort -rnk7 | more</code> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Activities == | == Activities == | ||
− | + | # Identify differences between <code>find</code> and <code>ls</code> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== See also == | == See also == | ||
− | * {{ | + | * {{fs}} |
− | * | + | * [[locate]] |
− | * [[ | + | * [[wikipedia:Find_(Windows)]] |
* {{mount}} | * {{mount}} | ||
− | * | + | * [[linux/Basic commands/du|du]]: <code>du -sh -- *</code> |
+ | |||
+ | [[Category:Linux]] | ||
− | |||
− | |||
{{CC license}} | {{CC license}} | ||
Source: https://en.wikiversity.org/wiki/Linux/Basic_commands/find | Source: https://en.wikiversity.org/wiki/Linux/Basic_commands/find |
Advertising: