免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1342 | 回复: 4
打印 上一主题 下一主题

[系统管理] How many types of file are there in Linux/Unix? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-08-18 17:20 |只看该作者 |倒序浏览
How many types of file are there in Linux/Unix?

By default Unix have only 3 types of files. They are..

Regular files
Directory files
Special files(This category is having 5 sub types in it.)

So in practical we have total 7 types(1+1+5) of files in Linux/Unix. And in Solaris we have 8 types.
And you can see the file type indication at leftmost part of “ls -l” command.

Here are those files type.

Regular file(-)
Directory files(d)
Special files
Block file(b)
Character device file(c)
Named pipe file or just a pipe file(p)
Symbolic link file(l)
Socket file(s)

论坛徽章:
0
2 [报告]
发表于 2014-08-18 17:23 |只看该作者
rootP:/dev # ll
total 0
drwxr-xr-x   3 root root          60 Aug 18 02:23 .sysconfig
drwxr-xr-x   7 root root         160 Aug 18 02:24 .udev
lrwxrwxrwx   1 root root           4 Aug 18 02:23 X0R -> null
crw-rw----+  1 root audio    14,  12 Aug 18 02:24 adsp
drwxr-xr-x   2 root root         320 Aug 18 02:23 block
prw-------   1 root root           0 Aug 18 02:24 blog
prw-------   1 root root           0 Aug 18 02:24 bootsplash
drwxr-xr-x   2 root root         100 Aug 18 02:23 bsg
drwxr-xr-x   3 root root          60 Aug 18 02:23 bus
lrwxrwxrwx   1 root root           3 Aug 18 02:23 cdrom -> sr0
lrwxrwxrwx   1 root root           3 Aug 18 02:23 cdrom1 -> sr1
lrwxrwxrwx   1 root root           3 Aug 18 02:23 cdrw -> sr0
lrwxrwxrwx   1 root root           3 Aug 18 02:23 cdrw1 -> sr1
drwxr-xr-x   2 root root        3320 Aug 18 02:24 char
crw-------   1 root root      5,   1 Aug 18 02:23 console
lrwxrwxrwx   1 root root          11 Jul  9 10:09 core -> /proc/kcore
drwxr-xr-x  10 root root         220 Aug 18 02:24 cpu
crw-rw----   1 root root     10,  62 Aug 18 02:23 cpu_dma_latency
srw-rw-rw-   1 root root           0 Aug 18 02:24 log
brw-rw----   1 root disk      7,   0 Aug 18 02:23 loop0
brw-rw----   1 root disk      7,   1 Aug 18 02:23 loop1

论坛徽章:
0
3 [报告]
发表于 2014-08-18 17:24 |只看该作者
Directory file type explained in Linux/Unix
These type of files contains regular files/folders/special files stored on a physical device. And this type of files will be in blue in color with link greater than or equal 2.

How can we list them in my present working directory?
ls -l | grep ^d
Example listing of directories.

drwxr-xr-x 2 surendra surendra 4096 2010-01-19 18:37 bin
drwxr-xr-x 5 surendra surendra 4096 2010-02-15 18:46 Desktop
drwxr-xr-x 2 surendra surendra 4096 2010-01-18 14:36 Documents
drwxr-xr-x 2 surendra surendra 4096 2010-02-13 17:45 Downloads
How to create them?
Ans : Use mkdir command

Block file type in Linux
These files are hardware files most of them are present in /dev.

How to create them?
Ans : Use fdisk command or create virtual partition.

How can we list them in my present working directory?

ls -l | grep ^b

Example listing of Block files(for you to see these file, they are located in /dev).

brw-rw—- 1 root disk 8, 1 2010-02-15 09:35 sda1
brw-rw—- 1 root disk 8, 2 2010-02-15 09:35 sda2
brw-rw—- 1 root disk 8, 5 2010-02-15 09:35 sda5
Character device files in Linux
Provides a serial stream of input or output.Your terminals are classic example for this type of files.

How can we list character files in my present working directory?

ls -l | grep ^c

Example listing of character files(located in /dev)

论坛徽章:
224
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:1015-16赛季CBA联赛之四川
日期:2023-07-25 16:53:45操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
4 [报告]
发表于 2014-08-18 19:39 |只看该作者
小伙子,知道ll什么意思??

论坛徽章:
0
5 [报告]
发表于 2014-08-19 09:18 |只看该作者
ls -l 回复 4# action08


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP