Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung Nächste Überarbeitung Beide Seiten, nächste Überarbeitung | ||
lpi1:find [2016/06/28 14:16] ingo_wichmann [find] |
lpi1:find [2023/05/17 07:47] sh |
||
---|---|---|---|
Zeile 5: | Zeile 5: | ||
* Wie viele README-Dateien gibt es im System? | * Wie viele README-Dateien gibt es im System? | ||
- | * In welchen Verzeichnissen sind die meisten Bilder? (( | + | * In welchen Verzeichnissen sind die meisten jpg-Bilder? (( |
- | find /usr/ -iname '*.png' -o -iname '*.jpg' -printf '%h\n' | uniq -c | sort -n | + | find /usr/ -iname '*.jpg' -printf '%h\n' | uniq -c | sort -n |
+ | oder | ||
+ | find /usr/ -iname '*.jpg' | xargs dirname | sort | uniq -c | sort -n | ||
)) | )) | ||
* Welches sind die am häufigsten vergebenen Berechtigungen im System? (( | * Welches sind die am häufigsten vergebenen Berechtigungen im System? (( | ||
Zeile 18: | Zeile 20: | ||
time find doc -type f -executable -exec chmod -x {} \; | time find doc -type f -executable -exec chmod -x {} \; | ||
time find doc -type f -executable -exec chmod -x {} + | time find doc -type f -executable -exec chmod -x {} + | ||
- | find doc -type f -executable -print0 | xargs -0 chmod -x | + | find doc -type f -executable -print0 | xargs -0 -r chmod -x |
+ | # mit Zeitmessung (als shell gruppe) | ||
+ | time { find doc -type f -executable -print0 | xargs -0 -r chmod -x; } | ||
===== Ausgabe steuern ===== | ===== Ausgabe steuern ===== | ||
Zeile 32: | Zeile 36: | ||
date -r /tmp/1_day_ago_12_hours_ago | date -r /tmp/1_day_ago_12_hours_ago | ||
- | find /tmp -name '*ago' -mtime -1 | + | find /tmp -name '*ago' -mtime -1 2> /dev/null |
- | find /tmp -name '*ago' -mtime 1 | + | find /tmp -name '*ago' -mtime 1 2> /dev/null |
- | find /tmp -name '*ago' -mtime +1 | + | find /tmp -name '*ago' -mtime +1 2> /dev/null |
- | find /tmp -name '*ago' -mtime +0 | + | find /tmp -name '*ago' -mtime +0 2> /dev/null |
- | find / -xdev -newer /tmp vorher | + | |
+ | touch -d '2017-01-01 9:00' /tmp/stamp | ||
+ | find / -xdev -newer /tmp/stamp | ||
+ | ===== nach Rechten suchen ===== | ||
+ | find / -perm /u=x | ||
+ | ===== nach Usern/Gruppen suchen ===== | ||
+ | find / -user gabi | ||
+ | find / -gid 1002 | ||
+ | find / -nouser; find / -nogroup | ||
+ | |||
+ | ===== nach Symlinks suchen ===== | ||
+ | find ./Spielplatz -type l | ||
+ | ==== verwaiste Symlinks ==== | ||
+ | find -L / -xdev -type l -ls 2>/dev/null |