This shows you the differences between two versions of the page.
|
os_cp:locate_find [2024/03/11 20:28] jkonczak utworzono |
os_cp:locate_find [2026/03/31 14:08] (current) jkonczak |
||
|---|---|---|---|
| Line 50: | Line 50: | ||
| \\ | \\ | ||
| Otherwise, each argument ''//arg//'' that contains no wildcards ((as understood | Otherwise, each argument ''//arg//'' that contains no wildcards ((as understood | ||
| - | by the [[https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13|shell]] | + | by the [[https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_14|shell]] |
| – that is, ''*'' standing for any text, ''?'' standing for any character , and ''[…]'' standing for a range.)) | – that is, ''*'' standing for any text, ''?'' standing for any character , and ''[…]'' standing for a range.)) | ||
| is actually converted to a wildcard expression ''*//arg//*'' before matching | is actually converted to a wildcard expression ''*//arg//*'' before matching | ||
| Line 96: | Line 96: | ||
| While the ''find'' utility is part of | While the ''find'' utility is part of | ||
| - | [[https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html|POSIX standard]], | + | [[https://pubs.opengroup.org/onlinepubs/9799919799/utilities/find.html|POSIX standard]], |
| most implementations cover more functionality than what the standard mandates. | most implementations cover more functionality than what the standard mandates. | ||
| \\ | \\ | ||
| Line 103: | Line 103: | ||
| The ''find'' command has two noteworthy switches: \\ | The ''find'' command has two noteworthy switches: \\ | ||
| - | ''-L'' follows symlinks (default), \\ | + | ''-L'' follows symlinks (<small>notice that with this switch ''find'' won't match any files with ''-type l''</small>), \\ |
| - | ''-H'' des not follows symlinks (and only then ''find'' may be used to look for symlinks). | + | ''-H'' does not follow symlinks when scouting provided paths (default behaviour). |
| **''find'' has a fixed and counter-intuitive syntax – options come first, but | **''find'' has a fixed and counter-intuitive syntax – options come first, but | ||
| Line 127: | Line 127: | ||
| |''-user //name//'' \\ ''-group //name//''|file owner / group| | |''-user //name//'' \\ ''-group //name//''|file owner / group| | ||
| | \\ ''-perm //mode//'' \\ ''-perm -//mode//'' \\ ''-perm /%%%%//mode//'' \\ |permissions: \\ '' '' same as provided \\ ''-'' all provided bits set \\ ''/'' at least one of the provided bits set \\ mode can be either octal (''22'') or symbolic (''go+w'') | | | \\ ''-perm //mode//'' \\ ''-perm -//mode//'' \\ ''-perm /%%%%//mode//'' \\ |permissions: \\ '' '' same as provided \\ ''-'' all provided bits set \\ ''/'' at least one of the provided bits set \\ mode can be either octal (''22'') or symbolic (''go+w'') | | ||
| - | |''-size //s//''|size; ''512c'' stands for 512B; ''512M'' stands for 512MB; \\ ''-512c'' stands for at most 512B, ''+512c'' stands for at least 512B \\ Warning: the default unit, denoted with ''b'', are dist blocks, not bytes| | + | |''-size //s//''|size; ''512c'' stands for 512B; ''512M'' stands for 512MB; \\ ''-512c'' stands for at most 512B, ''+512c'' stands for at least 512B \\ //Warning//: the default unit, denoted with ''b'', are disk blocks, not bytes| |
| |''-atime //d//'' / ''-amin //min//'' \\ ''-ctime //d//'' / ''-cmin //min//'' \\ ''-mtime //d//'' / ''-mmin //min//'' |times: access, change, modification in //d//ays or //min//utes| | |''-atime //d//'' / ''-amin //min//'' \\ ''-ctime //d//'' / ''-cmin //min//'' \\ ''-mtime //d//'' / ''-mmin //min//'' |times: access, change, modification in //d//ays or //min//utes| | ||
| Line 138: | Line 138: | ||
| Other important tests include: | Other important tests include: | ||
| \\ | \\ | ||
| - | ''-mindepth //n//'' and ''-maxdepth //n//'' specify how deep find will scot the directories. | + | ''-mindepth //n//'' and ''-maxdepth //n//'' specify how deep find will scout the directories. |
| \\ | \\ | ||
| ''-xdev'' forbids entering directories where other filesystems are mounted. \\ | ''-xdev'' forbids entering directories where other filesystems are mounted. \\ | ||
| Line 176: | Line 176: | ||
| ~~Exercise.#~~ Issue, from your home directory, the commands ''find'' (with no | ~~Exercise.#~~ Issue, from your home directory, the commands ''find'' (with no | ||
| - | arguments), ''find .config/..'' oraz ''find ~''. \\ How do the results differ? | + | arguments), ''find .config/..'' and ''find ~''. \\ How do the results differ? |
| ~~Exercise.#~~ Find all files in the ''/srv/'' and ''/var/lib/zypp/'' directories | ~~Exercise.#~~ Find all files in the ''/srv/'' and ''/var/lib/zypp/'' directories | ||
| Line 183: | Line 183: | ||
| ~~Exercise.#~~ Find, in your home directory, files which names end with ''.xml''. | ~~Exercise.#~~ Find, in your home directory, files which names end with ''.xml''. | ||
| - | ~~Exercise.#~~ Find empty files in your home directory | + | ~~Exercise.#~~ Find empty files in your home directory. |
| <small> | <small> | ||