- 论坛徽章:
- 0
|
本帖最后由 hai314615910 于 2011-11-23 12:00 编辑
实验过程
/Documents/ch# ll -ld
drwxr-xr-x 2 root root 4096 2011-11-23 11:12 ./
# /Documents/ch目录的连接数为2
/Documents/ch# pwd
/root/Documents/ch
第一步:创建目录
/Documents/ch# mkdir 1
#创建1个目录
/Documents/ch# ll -ld
drwxr-xr-x 3 root root 4096 2011-11-23 11:13 ./
#/Documents/ch目录的连接数变为3
第二步:创建普通文件
/Documents/ch# touch 2
/Documents/ch# ls -ld
drwxr-xr-x 3 root root 4096 2011-11-23 11:13 .
#/Documents/ch目录的连接数仍为3
/Documents/ch# ls
1 2
第三步:进入所创建的目录中,并创建新目录2
/Documents/ch# cd 1
/Documents/ch/1# ls -ld
drwxr-xr-x 2 root root 4096 2011-11-23 11:13 .
/Documents/ch/1# mkdir 2
/Documents/ch/1# ls -ld
drwxr-xr-x 3 root root 4096 2011-11-23 11:14 .
#/Documents/ch/1的连接数为3
第四步:返回上级目录,查看连接数
/Documents/ch/1# cd ..
/Documents/ch# ls -ld
drwxr-xr-x 3 root root 4096 2011-11-23 11:13 .
#/Documents/ch的连接数仍为3,没 #有发生变化。
/Documents/ch# pwd
/root/Documents/ch
问题描述
1、在一个目录中创建新目录时,该目录的连接数会发生变化,每个目录的连接数等于该目录下的子目录的数目加2,但是创建普通文件则不会增加,why?
2、子目录和父目录是怎样的一种关系?普通文件与它所在目录是种什么关系?
3、“.”和”..”存在与每个目录中,它们是不是分别指向当前目录数据块和父目录数据块的硬链接?
4、unix系统中可以创建多少级子目录?这个是和系统内核有关还是和文件系统类型有关? |
|