- 论坛徽章:
- 0
|
In the following example, inode 1282 now has two hard links, one for
file1 and the other for file2. The ls -li command lists the inode
number in the left-most column. The find -inum command locates files
and directories that have the same inode numbers.
# ln file1 file2
# ls -l
total 0
-rw-r--r-- 2 root other 0 Apr 7 15:26 file1
-rw-r--r-- 2 root other 0 Apr 7 15:26 file2
# ls -li
total 0
1282 -rw-r--r-- 2 root other 0 Apr 7 15:26 file1
1282 -rw-r--r-- 2 root other 0 Apr 7 15:26 file2
# find . -inum 1282
./file1
./file2
# ls -lL
The symbolic links in the /dev/dsk directory point to block-special device
files.
# ls -lL
The /dev/pts directory contains symbolic links.
The symbolic links in the /dev/pts directory point to character-special
device files.
# ln -s file1 link1
10. List file1 and the link1 symbolic link. Do these files use the same
or different inodes?
# ls -li
These two files use two different inodes.
bash-3.00# touch file1
bash-3.00# ls -l file1
-rw-r--r-- 1 root root 0 6月 5日 13:12 file1
bash-3.00# ln -s file1 file2
bash-3.00# ls -li file*
91276 -rw-r--r-- 1 root root 0 6月 5日 13:12 file1
91287 lrwxrwxrwx 1 root root 5 6月 5日 13:12 file2 -> file1
bash-3.00# mkdir newdir
bash-3.00# ls -ldi newdir
378560 drwxr-xr-x 2 root root 512 6月 5日 13:14 newdir
bash-3.00# ls -lia newdir
总数 4
378560 drwxr-xr-x 2 root root 512 6月 5日 13:14 .
2 drwxr-xr-x 38 root root 1024 6月 5日 13:14 ..
bash-3.00# mkdir newdir/dir2
bash-3.00# ls -ldi newdir
378560 drwxr-xr-x 3 root root 512 6月 5日 13:17 newdir
bash-3.00# ls -laRi newdir
newdir:
总数 6
378560 drwxr-xr-x 3 root root 512 6月 5日 13:17 .
2 drwxr-xr-x 38 root root 1024 6月 5日 13:14 ..
378561 drwxr-xr-x 2 root root 512 6月 5日 13:17 dir2
newdir/dir2:
总数 4
378561 drwxr-xr-x 2 root root 512 6月 5日 13:17 .
378560 drwxr-xr-x 3 root root 512 6月 5日 13:17 ..
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/40476/showart_314915.html |
|