mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(find): more examples
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
# Find
|
# Find
|
||||||
|
|
||||||
## Table of contents <!-- omit in toc -->
|
|
||||||
|
|
||||||
1. [TL;DR](#tldr)
|
1. [TL;DR](#tldr)
|
||||||
1. [Time specifications](#time-specifications)
|
1. [Time specifications](#time-specifications)
|
||||||
1. [Gotchas](#gotchas)
|
1. [Gotchas](#gotchas)
|
||||||
@@ -9,6 +7,9 @@
|
|||||||
|
|
||||||
## TL;DR
|
## TL;DR
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Usage</summary>
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Change the permissions of all files and directories in the current directory,
|
# Change the permissions of all files and directories in the current directory,
|
||||||
# recursively.
|
# recursively.
|
||||||
@@ -94,12 +95,17 @@ find … 2>/dev/null
|
|||||||
find … 2> >(grep -v 'Permission denied' >&2) # BASH and ZSH only
|
find … 2> >(grep -v 'Permission denied' >&2) # BASH and ZSH only
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Time specifications
|
## Time specifications
|
||||||
|
|
||||||
Primaries used to check the difference between the file last access, creation or modification time and the time `find` was started.
|
Primaries used to check the difference between the file last access, creation or modification time and the time `find`
|
||||||
|
was started.
|
||||||
|
|
||||||
All time specification primaries take a numeric argument, and allow the number to be preceded by a plus sign (`+`) or a minus sign (`-`).<br/>
|
All time specification primaries take a numeric argument, and allow the number to be preceded by a plus sign (`+`) or a
|
||||||
A preceding plus sign means **more than `n`**, a preceding minus sign means **less than `n`** and neither means **exactly `n`**.
|
minus sign (`-`).<br/>
|
||||||
|
A preceding plus sign means **more than `n`**, a preceding minus sign means **less than `n`** and neither means
|
||||||
|
**exactly `n`**.
|
||||||
|
|
||||||
Accepted time information:
|
Accepted time information:
|
||||||
|
|
||||||
@@ -110,7 +116,8 @@ Accepted time information:
|
|||||||
|
|
||||||
With the `-Xmin` form, times are rounded up to the next full **minute**. This is the same as using `-Xtime Nm`.
|
With the `-Xmin` form, times are rounded up to the next full **minute**. This is the same as using `-Xtime Nm`.
|
||||||
|
|
||||||
With the `-Xtime` form, times depend on the given unit; if no unit is given, it defaults to full 24 hours periods (days).<br/>
|
With the `-Xtime` form, times depend on the given unit; if no unit is given, it defaults to full 24 hours periods
|
||||||
|
(days).<br/>
|
||||||
Accepted units:
|
Accepted units:
|
||||||
|
|
||||||
- `s` for seconds
|
- `s` for seconds
|
||||||
@@ -121,8 +128,11 @@ Accepted units:
|
|||||||
|
|
||||||
Any number of units may be combined in one `-Xtime` argument.
|
Any number of units may be combined in one `-Xtime` argument.
|
||||||
|
|
||||||
with the `-newerXY file` form, `find` checks if `file` has a more recent last access time (X=a), inode creation time (X=B), change time (X=c), or modification time (X=m) than the last access time (Y=a), inode creation time (Y=B), change time (Y=c), or modification time (Y=m).<br/>
|
with the `-newerXY file` form, `find` checks if `file` has a more recent last access time (X=a), inode creation time
|
||||||
If Y=t, `file` is interpreted as a direct date specification of the form understood by `cvs`. Also, `-newermm` is the same as `-newer`.
|
(X=B), change time (X=c), or modification time (X=m) than the last access time (Y=a), inode creation time (Y=B), change
|
||||||
|
time (Y=c), or modification time (Y=m).<br/>
|
||||||
|
If Y=t, `file` is interpreted as a direct date specification of the form understood by `cvs`. Also, `-newermm` is the
|
||||||
|
same as `-newer`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Find files last accessed exactly 5 minutes ago.
|
# Find files last accessed exactly 5 minutes ago.
|
||||||
@@ -187,7 +197,8 @@ find / -newer file.txt -user wnj -print
|
|||||||
- [How can I exclude all "permission denied" messages from "find"?]
|
- [How can I exclude all "permission denied" messages from "find"?]
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
References
|
Reference
|
||||||
|
═╬═Time══
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- Others -->
|
<!-- Others -->
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# Ignore permission errors.
|
# Ignore permission errors
|
||||||
# -------------------------
|
|
||||||
|
|
||||||
find '/' -type 'f' -name 'git-remote-keybase' 2>/dev/null
|
find '/' -type 'f' -name 'git-remote-keybase' 2>/dev/null
|
||||||
|
find '/' -type 'f' -name 'git-remote-keybase' -readable # GNU find only
|
||||||
|
|
||||||
# GNU find.
|
# Find files modified in the last 24h
|
||||||
find '/' -type 'f' -name 'git-remote-keybase' -readable
|
find '.' -newermt '24 hours ago'
|
||||||
|
find '.' -mtime '-24h'
|
||||||
|
|
||||||
find '.' -type 'd' -name '.git' -exec dirname {} ';' | xargs -I {} -n 1 -t git -C {} remote --verbose
|
# Find files changed in the last 24h
|
||||||
|
find '.' -newerct '24 hours ago'
|
||||||
|
find '.' -ctime '-24h'
|
||||||
|
|
||||||
|
find '.' -type 'd' -name '.git' -exec dirname {} ';' | xargs -t -I {} git -C {} remote --verbose
|
||||||
|
|||||||
Reference in New Issue
Block a user