Zum Inhalt springen

Find/Anwendungen/Links: Unterschied zwischen den Versionen

Aus Foxwiki
Die Seite wurde neu angelegt: „=== Links === ; -links Anzahl Findet Dateien, auf die Anzahl fester Links zeigen ; Dateien im Verzeichnis /usr mit 43 harten Links find /usr/ -links 43 2>/dev/null /usr/include /usr/share In den Ausgaben wurden die Fehler nach "/dev/null" verschoben, da find natürlich nur Verzeichnisse unter die Lupe nimmt, zu dessen Zugang der Benutzer berechtigt ist ; -lname Muster die Datei ist ein symbolischer Link auf eine Datei oder ein Verzeichnis mit einem zum…“
 
Keine Bearbeitungszusammenfassung
Zeile 22: Zeile 22:
* While most Unix and all Linux systems have a find command that supports the "‑inum" criterion, this isnt POSIX standard
* While most Unix and all Linux systems have a find command that supports the "‑inum" criterion, this isnt POSIX standard
* Older Unix systems provided the "ncheck" utility instead that could be used for this
* Older Unix systems provided the "ncheck" utility instead that could be used for this
[[Kategorie:Linux/Befehl]]
[[Kategorie:findutils]]

Version vom 13. September 2025, 13:17 Uhr

Links

-links Anzahl

Findet Dateien, auf die Anzahl fester Links zeigen

Dateien im Verzeichnis /usr mit 43 harten Links
find /usr/ -links 43 2>/dev/null /usr/include /usr/share

In den Ausgaben wurden die Fehler nach "/dev/null" verschoben, da find natürlich nur Verzeichnisse unter die Lupe nimmt, zu dessen Zugang der Benutzer berechtigt ist

-lname Muster

die Datei ist ein symbolischer Link auf eine Datei oder ein Verzeichnis mit einem zum Muster passenden Namen

-inum IN

die Datei belegt die Inode mit der Nummer N

find all the hard links

A common request is a way to find all the hard links to some file

  • Using "ls ‑li file" will tell you how many hard links the file has, and the inode number
  • You can locate all pathnames to this file with:
find mount-point -xdev -inum inode-number
  • Since hard links are restricted to a single filesystem, you need to search that whole filesystem so you start the search at the filesystems mount point. (This is likely to be either "/home" or "/" for files in your home directory.)
  • The "‑xdev" option tells find to not search (descend into) any other filesystems
  • While most Unix and all Linux systems have a find command that supports the "‑inum" criterion, this isnt POSIX standard
  • Older Unix systems provided the "ncheck" utility instead that could be used for this