zoukankan      html  css  js  c++  java
  • linux中的文件类型

    1.使用ls -l命令可以查看文件的类型和权限

    [tansheng@localhost etc]$ ls -l
    ----------.  1 root         root        899 10月 18 07:43 gshadow
    ----------.  1 root         root        890 10月 18 07:41 gshadow-
    -rw-r--r--.  1 root         root        801 4月   1 2011 gssapi_mech.conf
    drwxr-xr-x.  3 root         root       4096 10月 12 02:13 gtk-2.0
    drwxr-xr-x.  3 root         root       4096 10月 12 02:17 hal
    -rw-r--r--.  1 root         root        871 10月 12 02:01 hba.conf
    -rw-r--r--.  1 root         root          9 10月  2 2012 host.conf
    -rw-r--r--.  1 root         root        158 1月  12 2010 hosts
    -rw-r--r--.  1 root         root        370 1月  12 2010 hosts.allow
    -rw-r--r--.  1 root         root        460 1月  12 2010 hosts.deny
    drwxr-xr-x.  2 root         root       4096 10月 12 02:20 hp
    drwxr-xr-x.  2 root         root       4096 10月 12 02:02 htdig
    drwxr-xr-x.  5 root         root       4096 10月 12 02:16 httpd
    -rw-r--r--.  1 root         root       1066 9月  27 2012 ibm_hosts
    -rw-r--r--.  1 root         root       3581 11月  1 2012 idmapd.conf
    drwxr-xr-x.  2 root         root       4096 10月 12 02:25 init
    lrwxrwxrwx.  1 root         root         11 10月 12 01:59 init.d -> rc.d/init.d
    -rw-r--r--.  1 root         root        884 10月 12 02:40 inittab
    -rw-r--r--.  1 root         root        942 1月  12 2010 inputrc
    drwxr-xr-x.  3 root         root       4096 10月 12 02:21 ipa

    2.windows的文件类型有隐藏文件,只读文件,系统文件等,对应于linux文件的类型则更多:

    d  目录文件。

    l  符号链接(指向另一个文件,类似于瘟下的快捷方式)。

    s  套接字文件。

    b  块设备文件,二进制文件。

    c  字符设备文件。

    p  命名管道文件。

    -  普通文件,或者更准确地说,不属于以上几种类型的文件。

    3.文件的类型说明:

    b:block(块设备文件),在过去,在添加新磁盘后,往往需要手动增加块设备文件。现在通常我们不需要手动增加块设备文件,运行一下service kudzu start ,系统就会自动为您配置相应的设备。块设备的主要特点是可以随机读写,而最常见的块设备就是磁盘,如/dev/hda1 、/dev/sda2、/dev/fd0等。

    c:char(字符设备文件),同块设备一样,我们一般都可以用service kudzu start命令来自动增加、删除或修改字符设备。最常见的字符设备是打印机和终端,他们可以接受字符流。 /dev/null是一个非常有用的字符设备文件,送入这个设备的所有东西都被忽略。如果将任何程序的输出结果重定向到/dev/null,则看不到任何输出信息。甚至于,您可以将某一用户的shell指向/dev/null 以禁止其登陆。

    p:pipe(管道设备文件),管道设备文件有时候也被叫做FIFO文件(FIFO是先进先出的意思),从字面上理解,管道设备文件就是从一头流入,从另一头流出。通常我们会在其中做一些工作,以达到我们“吃的是草,挤出来的是奶”的目的。

    l:link(符号链接文件),类似于Windows 的所谓快捷方式,但并不完全一样。链接有两种方式,软链接和硬链接。软链接又叫符号链接,这个文件包含了另一个文件的路径名。可以是任意文件或目录,可以链接不同文件系统的文件。链接文件甚至可以链接不存在的文件,这就产生一般称之为"断链"的问题(或曰“现象"),链接文件甚至可以循环链接自己。 硬链接文件有两个限制  1、不允许给目录创建硬链接;2、只有在同一文件系统中的文件之间才能创建链接。

  • 相关阅读:
    AGC037F Counting of Subarrays
    AGC025F Addition and Andition
    CF506C Mr. Kitayuta vs. Bamboos
    AGC032D Rotation Sort
    ARC101F Robots and Exits
    AGC032E Modulo Pairing
    CF559E Gerald and Path
    CF685C Optimal Point
    聊聊Mysql索引和redis跳表
    什么是线程安全
  • 原文地址:https://www.cnblogs.com/ttss/p/4197157.html
Copyright © 2011-2022 走看看