パスワードを忘れた? アカウント作成
16536378 journal
日記

oginoの日記: macOSのハードリンク 5

日記 by ogino

Re:ファイル名だけで判別してを試してみたが、macOS 13.2.1 の /usr/bin 以下はハードリンクだらけだった。Xcode とか Java とかが同一なのかな。リンク数 76 とか 52 とか、2桁がごろごろ。

% cd /usr/bin; for inode in `ls -il | awk '{ print $1 }' | sort | uniq -d`; do ls -il | grep "^$inode "; echo; done
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 DeRez
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 GetFileInfo
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 ResMerger
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 Rez
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 SetFile
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 SplitForks
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 ar
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 as
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 asa
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 bison
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 c++
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 c++filt
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 c89
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 c99
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 cc
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 clang
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 clang++
1152921500312422514 -rwxr-xr-x 76 root wheel 167136 2 9 18:39 clangd
(略)
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 appletviewer
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 apt
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 extcheck
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 idlj
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 jar
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 jarsigner
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 java
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 javac
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 javadoc
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 javah
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 javap
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 javapackager
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 javaws
1152921500312422561 -rwxr-xr-x 52 root wheel 168384 2 9 18:39 jcmd
(略)

grep 系なんかは手抜きがある気がする。bzegrep と fgrep が一緒で bzfgrep が別ってなんだろう。なおファイルサイズが一緒だが、中身は違った。

1152921500312422647 -rwxr-xr-x 5 root wheel 186512 2 9 18:39 bzegrep
1152921500312422647 -rwxr-xr-x 5 root wheel 186512 2 9 18:39 bzgrep
1152921500312422647 -rwxr-xr-x 5 root wheel 186512 2 9 18:39 egrep
1152921500312422647 -rwxr-xr-x 5 root wheel 186512 2 9 18:39 fgrep
1152921500312422647 -rwxr-xr-x 5 root wheel 186512 2 9 18:39 grep

1152921500312422649 -rwxr-xr-x 4 root wheel 186512 2 9 18:39 bzfgrep
1152921500312422649 -rwxr-xr-x 4 root wheel 186512 2 9 18:39 zegrep
1152921500312422649 -rwxr-xr-x 4 root wheel 186512 2 9 18:39 zfgrep
1152921500312422649 -rwxr-xr-x 4 root wheel 186512 2 9 18:39 zgrep

元コメントの uniq -Dw7 は GNU uniq 専用オプションなので使えないし、i-node が 7桁とは限るまいに。Linux でも XFS とか長くなかったかな。
それにシンボリックリンクでも $0 は変わるし…

% cd /usr/bin; ls -l | grep ^l | grep -w sendmail
lrwxr-xr-x 1 root wheel 16 2 9 18:39 mailq -> ../sbin/sendmail
lrwxr-xr-x 1 root wheel 16 2 9 18:39 newaliases -> ../sbin/sendmail

% cd /usr/bin; ls -l | grep ^l | grep -w vim
lrwxr-xr-x 1 root wheel 3 2 9 18:39 ex -> vim
lrwxr-xr-x 1 root wheel 3 2 9 18:39 rview -> vim
lrwxr-xr-x 1 root wheel 3 2 9 18:39 rvim -> vim
lrwxr-xr-x 1 root wheel 3 2 9 18:39 vi -> vim
lrwxr-xr-x 1 root wheel 3 2 9 18:39 view -> vim
lrwxr-xr-x 1 root wheel 3 2 9 18:39 vimdiff -> vim

この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

物事のやり方は一つではない -- Perlな人

読み込み中...