LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 971|回复: 5

对ls -l /dev/hda*结果的疑问

[复制链接]
发表于 2004-6-1 21:52:54 | 显示全部楼层 |阅读模式
请见图片:为什么文件大小那一栏那样表示阿,和普通的不一样啊,请问是什么意思?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2004-6-1 21:58:27 | 显示全部楼层
因为这些是设备文件,不是普通文件。至于那些数字的意思,要找些资料看看。此帖移到基础版。
发表于 2004-6-1 22:14:04 | 显示全部楼层
对linux而言,各个分区对应不同的设备文件,这些文件都在 /dev目录下,如果你的硬盘是ide设备的话,就用hd开头,一般pc机上只能有4个ide设备,所以,hd后面跟a、b、c、d四个子母来表示四个 ide设备。hda就是机器中的第一个ide设备。hdaX中的X就是表示各个分区,其中主分区从1-4,逻辑分区从5开始,主分区+逻辑分区一共可以有63个。

brw-rw----  1 root disk 3,  1  9月 15  2003 /dev/hda1

其中disk后的3是ide设备在linux中的主设备号,3后面的1是指这个ide设备的次设备号,在这里和它的分区号一致。另外,如果是scsi硬盘的话,它的主设备号是8。
发表于 2004-6-1 22:19:07 | 显示全部楼层
linux/unix的哲学之一:一切皆文件
发表于 2004-6-1 22:27:15 | 显示全部楼层
这些数字的意思,主设备号和次设备号。
发表于 2004-6-1 23:14:04 | 显示全部楼层
man ls

  1.        -l     Write  (in single-column format) the file mode, the
  2.               number of links to the file, the  owner  name,  the
  3.               group  name,  the  size of the file (in bytes), the
  4.               timestamp, and the filename.

  5.               The file types are as follows: -  for  an  ordinary
  6.               file,  d  for  a  directory,  b for a block special
  7.               device, c for a character special device, l  for  a
  8.               symbolic link, p for a fifo, s for a socket.

  9.               By default, the timestamp shown is that of the last
  10.               modification; the options  -c  and  -u  select  the
  11.               other two timestamps.  [color=red]For device special files the
  12.               size field is commonly replaced by  the  major  and
  13.               minor device numbers.[/color]
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表