`/`へのハードリンク?

`/`へのハードリンク?

/Ubuntuには私を指す24のハードリンクがあります:

$ ls -ld /
drwxr-xr-x 24 root root 4096 May  6 13:39 /

私はそれが何であるか知りたいです。

そして2つのハードリンクが/.ありますか?/../

$ ls -a /
.   bin   cdrom  etc   initrd.img      lib    lost+found  mnt  proc  run   share  sys  usr  vmlinuz
..  boot  dev    home  initrd.img.old  lib64  media       opt  root  sbin  srv    tmp  var  vmlinuz.old

$ ls /..
bin   cdrom  etc   initrd.img      lib    lost+found  mnt  proc  run   share  sys  usr  vmlinuz
boot  dev    home  initrd.img.old  lib64  media       opt  root  sbin  srv    tmp  var  vmlinuz.old

その下には27のファイルがあり、/4 /つのシンボリックリンクと23のサブディレクトリがあり、各サブディレクトリにはハードリンクが含まれています/

$ ls / -l |wc -l
27

$ ls -l /
total 108
drwxr-xr-x   2 root root  4096 Apr 16 08:10 bin
drwxr-xr-x   3 root root  4096 May  5 10:46 boot
drwxrwxr-x   2 root root  4096 Mar  8 22:10 cdrom
drwxr-xr-x  17 root root  4640 May  6 19:56 dev
drwxr-xr-x 148 root root 12288 May  6 18:31 etc
drwxr-xr-x   4 root root  4096 Mar  8 22:12 home
lrwxrwxrwx   1 root root    33 May  5 10:44 initrd.img -> boot/initrd.img-3.16.0-37-generic
lrwxrwxrwx   1 root root    33 Apr 30 12:19 initrd.img.old -> boot/initrd.img-3.16.0-36-generic
drwxr-xr-x  24 root root  4096 Mar  9 11:48 lib
drwxr-xr-x   2 root root  4096 Mar  8 22:23 lib64
drwx------   2 root root 16384 Mar  8 22:07 lost+found
drwxr-xr-x   3 root root  4096 Mar  8 22:53 media
drwxr-xr-x   2 root root  4096 Apr 10  2014 mnt
drwxr-xr-x   9 root root  4096 Apr 15 23:43 opt
dr-xr-xr-x 252 root root     0 May  4 07:30 proc
drwx------   8 root root  4096 Mar 15 22:46 root
drwxr-xr-x  27 root root   940 May  6 13:11 run
drwxr-xr-x   2 root root 12288 Apr 24 03:21 sbin
drwxr-xr-x   3 root root  4096 Apr 22 19:24 share
drwxr-xr-x   2 root root  4096 Feb 18 14:33 srv
dr-xr-xr-x  13 root root     0 May  6 22:12 sys
drwxrwxrwt  15 root root 12288 May  6 22:17 tmp
drwxr-xr-x  10 root root  4096 Apr 22 19:19 usr
drwxr-xr-x  13 root root  4096 Feb 18 14:41 var
lrwxrwxrwx   1 root root    30 May  5 10:44 vmlinuz -> boot/vmlinuz-3.16.0-37-generic
lrwxrwxrwx   1 root root    30 Apr 30 12:19 vmlinuz.old -> boot/vmlinuz-3.16.0-36-generic

その後、23 + 2 = 25のハードリンクが必要です/。しかし、なぜ24個ですか?

ありがとうございます。

ベストアンサー1

ディレクトリまで含めると、合計28個のファイルがあります。

ls / | wc -l「total」行を含むがディレクトリは含まないので...27は28になります。

initrd.imginitrd.img.oldおよびvmlinuzを除くと、vmlinuz.oldディレクトリリンク(通常のファイルやシンボリックリンク)ではなく、24になります。

おすすめ記事