Merge pull request #1218 from mtking2/find-cheatsheet
This commit is contained in:
commit
1333ccada0
19
find.md
19
find.md
|
@ -2,6 +2,7 @@
|
||||||
title: Find
|
title: Find
|
||||||
category: CLI
|
category: CLI
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
|
updated: 2019-10-01
|
||||||
---
|
---
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
@ -48,6 +49,20 @@ find <path> <conditions> <actions>
|
||||||
-newerXt "1 hour ago" # [t]imestamp
|
-newerXt "1 hour ago" # [t]imestamp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Access time conditions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
-atime 0 # Last accessed between now and 24 hours ago
|
||||||
|
-atime +0 # Accessed more than 24 hours ago
|
||||||
|
-atime 1 # Accessed between 24 and 48 hours ago
|
||||||
|
-atime +1 # Accessed more than 48 hours ago
|
||||||
|
-atime -1 # Accessed less than 24 hours ago (same a 0)
|
||||||
|
-ctime -6h30m # File status changed within the last 6 hours and 30 minutes
|
||||||
|
-mtime +1w # Last modified more than 1 week ago
|
||||||
|
```
|
||||||
|
|
||||||
|
These conditions only work in MacOS and BSD-like systems (no GNU/Linux support).
|
||||||
|
|
||||||
### Condition flow
|
### Condition flow
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -73,3 +88,7 @@ find . -name '*.jpg' -exec rm {} \;
|
||||||
```bash
|
```bash
|
||||||
find . -newerBt "24 hours ago"
|
find . -newerBt "24 hours ago"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -type f -mtime +29 # find files modified more than 30 days ago
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue