天天看点

linux文件类型

linux文件类型

linux文件的类型 

在Linux中只有一下7种文件类型

    即使开发人员在Linux文件树中添加新内容也必须符合一下之一

    1.普通文件(-表示,可用ls -l查看)

    2.目录(d)[在Linux中,任何东西都被看成文件,外设备也看成文件,注意是任何东西]

    3.字符设备文件(c)

    4.块设备文件(b)

    5.套接口文件(s)[如我们开启MySQL服务后,在/var/lib/mysql/下生成的mysql.sock文件,关闭MySQL服务后,这个文件就消失了]

    6.管道(p)[管道在Linux/UNIX中式非常有用的东西,必须掌握哈]

    7.符号链接文件(l)[有点儿像WIN下的快捷方式]

    Linux中只有以上7中文件类型,没有其他的....

    另外,我们用ls -al 可以查看当前目录下的所有文件,这是我们可以看到"."和".."这两个文件

    其实"."就是代表当前目录

    ".."就是代表上级目录,因为Linux把任何东西都看成文件,所以就有"."和".."这两个文件了喂...

[root@alex ~]# ls -la

total 56

dr-xr-x---.  7 root root 4096 Oct 18 08:46 .     目录文件 

dr-xr-xr-x. 18 root root 4096 Oct 16 12:59 ..

-rw-------   1 root root  353 Oct 20 05:30 .bash_history     普通文件  

-rw-r--r--.  1 root root   18 Dec 29  2013 .bash_logout

-rw-r--r--.  1 root root  176 Dec 29  2013 .bash_profile

-rw-r--r--.  1 root root  176 Dec 29  2013 .bashrc

drwxr-xr-x   2 root root 4096 Oct 16 14:01 c

drwx------   3 root root 4096 Aug 17 07:47 .cache

-rw-r--r--.  1 root root  100 Dec 29  2013 .cshrc

drwxr-xr-x   2 root root 4096 Oct 18 08:46 m

drwxr-xr-x   2 root root 4096 Aug 17 07:48 .pip

-rw-r--r--   1 root root   64 Aug 17 07:48 .pydistutils.cfg

drwx------   2 root root 4096 Oct 21 02:08 .ssh

-rw-r--r--.  1 root root  129 Dec 29  2013 .tcshrc

[root@alex ~]# ls -l /dev  

crw------- 1 root root     10, 235 Oct 16 12:59 autofs   字符串设备   鼠标键盘全部都是  c

lrwxrwxrwx 1 root root          13 Oct 16 20:59 fd -> /proc/self/fd   软连接    

brw-rw---- 1 root disk    253,   0 Oct 16 12:59 vda       块设备 

[root@alex ~]# ls -l /dev/log                                      sock 文件  通信 

srw-rw-rw- 1 root root 0 Oct 16 20:59 /dev/log

本文转自 amenging 51CTO博客,原文链接:http://blog.51cto.com/11335852/1974795

下一篇: ls命令

继续阅读