Linux的文件类型

142 阅读10分钟

文件类型:d、-

[root@yang-1 ~]# ls -la
总用量 60
dr-xr-x---.  3 root root   218 9月  20 21:06 .
dr-xr-xr-x. 17 root root   224 921 22:00 ..
-rw-------.  1 root root  1418 9月  18 06:27 anaconda-ks.cfg
-rw-------.  1 root root  3529 9月  23 23:49 .bash_history
-rw-r--r--.  1 root root    18 12月 29 2013 .bash_logout
-rw-r--r--.  1 root root   176 12月 29 2013 .bash_profile
-rw-r--r--.  1 root root   176 12月 29 2013 .bashrc
-rw-r--r--.  1 root root   100 12月 29 2013 .cshrc
-rw-r--r--.  1 root root    58 9月  18 22:46 dnfaifonvvreigh
-rw-------.  1 root root    35 9月  18 22:46 .lesshst
drwx------.  2 root root    80 9月  22 20:55 .ssh
-rw-------.  1 root root 12288 9月  20 20:43 .ssh.swo
-rw-------.  1 root root 12288 9月  20 20:42 .ssh.swp
-rw-r--r--.  1 root root   129 12月 29 2013 .tcshrc
[root@yang-1 ~]# 
//d表示目录
//-表示普通文件,文本文档,二进制

文件类型:c、l、b

[root@yang-1 ~]# ls -l /dev/
总用量 0
crw-rw----. 1 root video    10, 175 9月  24 21:04 agpgart
crw-------. 1 root root     10, 235 9月  24 21:04 autofs
drwxr-xr-x. 2 root root         140 924 21:04 block
drwxr-xr-x. 2 root root          80 924 21:04 bsg
crw-------. 1 root root     10, 234 9月  24 21:04 btrfs-control
drwxr-xr-x. 3 root root          60 924 21:04 bus
lrwxrwxrwx. 1 root root           3 924 21:04 cdrom -> sr0
drwxr-xr-x. 2 root root        3020 924 21:04 char
crw-------. 1 root root      5,   1 9月  24 21:04 console
lrwxrwxrwx. 1 root root          11 924 21:04 core -> /proc/kcore
drwxr-xr-x. 3 root root          60 924 21:04 cpu
crw-------. 1 root root     10,  61 9月  24 21:04 cpu_dma_latency
crw-------. 1 root root     10,  62 9月  24 21:04 crash
drwxr-xr-x. 6 root root         120 924 21:04 disk
crw-rw----. 1 root audio    14,   9 9月  24 21:04 dmmidi
drwxr-xr-x. 2 root root          80 924 21:04 dri
crw-rw----. 1 root video    29,   0 9月  24 21:04 fb0
lrwxrwxrwx. 1 root root          13 924 21:04 fd -> /proc/self/fd
crw-rw-rw-. 1 root root      1,   7 924 21:04 full
crw-rw-rw-. 1 root root     10, 229 924 21:04 fuse
crw-------. 1 root root    246,   0 9月  24 21:04 hidraw0
crw-------. 1 root root     10, 228 9月  24 21:04 hpet
drwxr-xr-x. 2 root root           0 924 21:04 hugepages
crw-------. 1 root root     10, 183 9月  24 21:04 hwrng
lrwxrwxrwx. 1 root root          25 924 21:04 initctl -> /run/systemd/initctl/fifo
drwxr-xr-x. 4 root root         300 924 21:04 input
crw-r--r--. 1 root root      1,  11 9月  24 21:04 kmsg
srw-rw-rw-. 1 root root           0 924 21:04 log
crw-rw----. 1 root disk     10, 237 9月  24 21:04 loop-control
drwxr-xr-x. 2 root root          60 924 21:04 mapper
crw-------. 1 root root     10, 227 9月  24 21:04 mcelog
crw-r-----. 1 root kmem      1,   1 9月  24 21:04 mem
crw-rw----. 1 root audio    14,   2 9月  24 21:04 midi
drwxrwxrwt. 2 root root          40 924 21:04 mqueue
drwxr-xr-x. 2 root root          60 924 21:04 net
crw-------. 1 root root     10,  60 9月  24 21:04 network_latency
crw-------. 1 root root     10,  59 9月  24 21:04 network_throughput
crw-rw-rw-. 1 root root      1,   3 924 21:04 null
crw-------. 1 root root     10, 144 9月  24 21:04 nvram
crw-------. 1 root root      1,  12 9月  24 21:04 oldmem
crw-r-----. 1 root kmem      1,   4 9月  24 21:04 port
crw-------. 1 root root    108,   0 9月  24 21:04 ppp
crw-rw-rw-. 1 root tty       5,   2 924 21:07 ptmx
drwxr-xr-x. 2 root root           0 924 21:04 pts
crw-rw-rw-. 1 root root      1,   8 924 21:04 random
drwxr-xr-x. 2 root root          60 924 21:04 raw
crw-rw-r--. 1 root root     10,  57 9月  24 21:04 rfkill
lrwxrwxrwx. 1 root root           4 924 21:04 rtc -> rtc0
crw-------. 1 root root    252,   0 9月  24 21:04 rtc0
brw-rw----. 1 root disk      8,   0 9月  24 21:04 sda
brw-rw----. 1 root disk      8,   1 9月  24 21:04 sda1
brw-rw----. 1 root disk      8,   2 9月  24 21:04 sda2
brw-rw----. 1 root disk      8,   3 9月  24 21:04 sda3
crw-rw----. 1 root disk     21,   0 9月  24 21:04 sg0
crw-rw----. 1 root cdrom    21,   1 9月  24 21:04 sg1
drwxrwxrwt. 2 root root          40 924 21:04 shm
crw-------. 1 root root     10, 231 9月  24 21:04 snapshot
drwxr-xr-x. 3 root root         200 924 21:04 snd
brw-rw----. 1 root cdrom    11,   0 9月  24 21:04 sr0
lrwxrwxrwx. 1 root root          15 924 21:04 stderr -> /proc/self/fd/2
lrwxrwxrwx. 1 root root          15 924 21:04 stdin -> /proc/self/fd/0
lrwxrwxrwx. 1 root root          15 924 21:04 stdout -> /proc/self/fd/1
crw-rw-rw-. 1 root tty       5,   0 924 21:04 tty
crw--w----. 1 root tty       4,   0 9月  24 21:04 tty0
crw--w----. 1 root tty       4,   1 9月  24 21:04 tty1
crw--w----. 1 root tty       4,  10 9月  24 21:04 tty10
crw--w----. 1 root tty       4,  11 9月  24 21:04 tty11
crw--w----. 1 root tty       4,  12 9月  24 21:04 tty12
crw--w----. 1 root tty       4,  13 9月  24 21:04 tty13
crw--w----. 1 root tty       4,  14 9月  24 21:04 tty14
crw--w----. 1 root tty       4,  15 9月  24 21:04 tty15
crw--w----. 1 root tty       4,  16 9月  24 21:04 tty16
crw--w----. 1 root tty       4,  17 9月  24 21:04 tty17
crw--w----. 1 root tty       4,  18 9月  24 21:04 tty18
crw--w----. 1 root tty       4,  19 9月  24 21:04 tty19
crw--w----. 1 root tty       4,   2 9月  24 21:04 tty2
crw--w----. 1 root tty       4,  20 9月  24 21:04 tty20
crw--w----. 1 root tty       4,  21 9月  24 21:04 tty21
crw--w----. 1 root tty       4,  22 9月  24 21:04 tty22
crw--w----. 1 root tty       4,  23 9月  24 21:04 tty23
crw--w----. 1 root tty       4,  24 9月  24 21:04 tty24
crw--w----. 1 root tty       4,  25 9月  24 21:04 tty25
crw--w----. 1 root tty       4,  26 9月  24 21:04 tty26
crw--w----. 1 root tty       4,  27 9月  24 21:04 tty27
crw--w----. 1 root tty       4,  28 9月  24 21:04 tty28
crw--w----. 1 root tty       4,  29 9月  24 21:04 tty29
crw--w----. 1 root tty       4,   3 9月  24 21:04 tty3
crw--w----. 1 root tty       4,  30 9月  24 21:04 tty30
crw--w----. 1 root tty       4,  31 9月  24 21:04 tty31
crw--w----. 1 root tty       4,  32 9月  24 21:04 tty32
crw--w----. 1 root tty       4,  33 9月  24 21:04 tty33
crw--w----. 1 root tty       4,  34 9月  24 21:04 tty34
crw--w----. 1 root tty       4,  35 9月  24 21:04 tty35
crw--w----. 1 root tty       4,  36 9月  24 21:04 tty36
crw--w----. 1 root tty       4,  37 9月  24 21:04 tty37
crw--w----. 1 root tty       4,  38 9月  24 21:04 tty38
crw--w----. 1 root tty       4,  39 9月  24 21:04 tty39
crw--w----. 1 root tty       4,   4 9月  24 21:04 tty4
crw--w----. 1 root tty       4,  40 9月  24 21:04 tty40
crw--w----. 1 root tty       4,  41 9月  24 21:04 tty41
crw--w----. 1 root tty       4,  42 9月  24 21:04 tty42
crw--w----. 1 root tty       4,  43 9月  24 21:04 tty43
crw--w----. 1 root tty       4,  44 9月  24 21:04 tty44
crw--w----. 1 root tty       4,  45 9月  24 21:04 tty45
crw--w----. 1 root tty       4,  46 9月  24 21:04 tty46
crw--w----. 1 root tty       4,  47 9月  24 21:04 tty47
crw--w----. 1 root tty       4,  48 9月  24 21:04 tty48
crw--w----. 1 root tty       4,  49 9月  24 21:04 tty49
crw--w----. 1 root tty       4,   5 9月  24 21:04 tty5
crw--w----. 1 root tty       4,  50 9月  24 21:04 tty50
crw--w----. 1 root tty       4,  51 9月  24 21:04 tty51
crw--w----. 1 root tty       4,  52 9月  24 21:04 tty52
crw--w----. 1 root tty       4,  53 9月  24 21:04 tty53
crw--w----. 1 root tty       4,  54 9月  24 21:04 tty54
crw--w----. 1 root tty       4,  55 9月  24 21:04 tty55
crw--w----. 1 root tty       4,  56 9月  24 21:04 tty56
crw--w----. 1 root tty       4,  57 9月  24 21:04 tty57
crw--w----. 1 root tty       4,  58 9月  24 21:04 tty58
crw--w----. 1 root tty       4,  59 9月  24 21:04 tty59
crw--w----. 1 root tty       4,   6 9月  24 21:04 tty6
crw--w----. 1 root tty       4,  60 9月  24 21:04 tty60
crw--w----. 1 root tty       4,  61 9月  24 21:04 tty61
crw--w----. 1 root tty       4,  62 9月  24 21:04 tty62
crw--w----. 1 root tty       4,  63 9月  24 21:04 tty63
crw--w----. 1 root tty       4,   7 9月  24 21:04 tty7
crw--w----. 1 root tty       4,   8 9月  24 21:04 tty8
crw--w----. 1 root tty       4,   9 9月  24 21:04 tty9
crw-rw----. 1 root dialout   4,  64 9月  24 21:04 ttyS0
crw-rw----. 1 root dialout   4,  65 9月  24 21:04 ttyS1
crw-rw----. 1 root dialout   4,  66 9月  24 21:04 ttyS2
crw-rw----. 1 root dialout   4,  67 9月  24 21:04 ttyS3
crw-------. 1 root root     10, 239 9月  24 21:04 uhid
crw-------. 1 root root     10, 223 9月  24 21:04 uinput
crw-rw-rw-. 1 root root      1,   9 924 21:04 urandom
crw-------. 1 root root    247,   0 9月  24 21:04 usbmon0
crw-------. 1 root root    247,   1 9月  24 21:04 usbmon1
crw-------. 1 root root    247,   2 9月  24 21:04 usbmon2
crw-rw----. 1 root tty       7,   0 9月  24 21:04 vcs
crw-rw----. 1 root tty       7,   1 9月  24 21:04 vcs1
crw-rw----. 1 root tty       7,   2 9月  24 21:04 vcs2
crw-rw----. 1 root tty       7,   3 9月  24 21:04 vcs3
crw-rw----. 1 root tty       7,   4 9月  24 21:04 vcs4
crw-rw----. 1 root tty       7,   5 9月  24 21:04 vcs5
crw-rw----. 1 root tty       7,   6 9月  24 21:04 vcs6
crw-rw----. 1 root tty       7, 128 9月  24 21:04 vcsa
crw-rw----. 1 root tty       7, 129 9月  24 21:04 vcsa1
crw-rw----. 1 root tty       7, 130 9月  24 21:04 vcsa2
crw-rw----. 1 root tty       7, 131 9月  24 21:04 vcsa3
crw-rw----. 1 root tty       7, 132 9月  24 21:04 vcsa4
crw-rw----. 1 root tty       7, 133 9月  24 21:04 vcsa5
crw-rw----. 1 root tty       7, 134 9月  24 21:04 vcsa6
drwxr-xr-x. 2 root root          60 924 21:04 vfio
crw-------. 1 root root     10,  63 9月  24 21:04 vga_arbiter
crw-------. 1 root root     10, 137 9月  24 21:04 vhci
crw-------. 1 root root     10, 238 9月  24 21:04 vhost-net
crw-------. 1 root root     10,  58 9月  24 21:04 vmci
crw-------. 1 root root     10,  56 9月  24 21:04 vsock
crw-rw-rw-. 1 root root      1,   5 924 21:04 zero
[root@yang-1 ~]# 
//c表示字符串设备,鼠标,键盘
//l表示软链接文件
//b块设备,光盘,磁盘

文件类型:s

[root@yang-1 ~]# ls -l /dev/log
srw-rw-rw-. 1 root root 0 924 21:04 /dev/log
[root@yang-1 ~]# 
//s表示socket文件类似于管道,但它是在网络上面工作的