• linux系统的文件类型学习


    linux是一个文件型操作系统,在linux下一切皆文件。
    目录、字符设备、块设备、管道、套接字、符号连接文件等在linux下统统都是文件。

    linux下的文件类型分为以下几种类型:
    1. 正规文件,
    2. 目录,
    3. 字符设备,
    4. 块设备,
    5. 套接字文件,
    6. 管道,
    7. 符号链接文件。

    目前我知道有两种方法查看文件类型:
    1. 使用ls -l进行查看,
    2. 使用stat命令进行查看

    sh-# ls -l /tmp/file.txt
    -rw-r--r-- 1 root root 0 Oct 12 09:45 /tmp/file.txt
    sh-#
    sh-# stat /tmp/file.txt
      File: "/tmp/file.txt"
      Size: 0               Blocks: 0          IO Block: 4096   regular empty file
    Device: eh/14d  Inode: 42592       Links: 1
    Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2013-10-12 09:45:41.000000000
    Modify: 2013-10-12 09:45:41.000000000
    Change: 2013-10-12 09:45:41.000000000

    sh-#

    sh-# ls -ld /tmp/directory/
    drwxr-xr-x 2 root root 40 Oct 12 09:57 /tmp/directory/
    sh-#
    sh-# stat /tmp/directory/
      File: "/tmp/directory/"
      Size: 40              Blocks: 0          IO Block: 4096   directory
    Device: eh/14d  Inode: 57315       Links: 2
    Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2013-10-12 09:57:09.000000000
    Modify: 2013-10-12 09:57:02.000000000
    Change: 2013-10-12 09:57:02.000000000

    sh-#

    sh-# ls -l /dev/console
    crw-r--r-- 1 root root 5, 1 Oct 12 09:58 /dev/console
    sh-#
    sh-# stat /dev/console
      File: "/dev/console"
      Size: 0               Blocks: 0          IO Block: 4096   character special file
    Device: fe00h/65024d    Inode: 425         Links: 1     Device type: 5,1
    Access: (0644/crw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2013-10-12 09:58:28.000000000
    Modify: 2013-10-12 09:58:28.000000000
    Change: 2013-10-12 03:48:49.000000000

    sh-#

    sh-# ls -l /dev/sda1
    brw-r--r-- 1 root root 8, 1 Oct 12 03:48 /dev/sda1
    sh-#
    sh-# stat /dev/sda1
      File: "/dev/sda1"
      Size: 0               Blocks: 0          IO Block: 4096   block special file
    Device: fe00h/65024d    Inode: 722         Links: 1     Device type: 8,1
    Access: (0644/brw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2013-10-12 03:48:49.000000000
    Modify: 2013-10-12 03:48:49.000000000
    Change: 2013-10-12 03:48:49.000000000

    sh-#

    sh-# ls -l /bin/cp
    lrwxrwxrwx 1 root root 15 Oct 12 03:47 /bin/cp -> /openbox/bin/cp
    sh-# stat /bin/cp
      File: "/bin/cp -> /openbox/bin/cp"
      Size: 15              Blocks: 0          IO Block: 4096   symbolic link
    Device: fe00h/65024d    Inode: 360         Links: 1
    Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2013-10-12 03:47:22.000000000
    Modify: 2013-10-12 03:47:22.000000000
    Change: 2013-10-12 03:47:22.000000000

    sh-#

    sh-# mkfifo /tmp/fifo
    sh-# ls -l /tmp/fifo
    prw-r--r-- 1 root root 0 Oct 12 10:05 /tmp/fifo
    sh-#
    sh-# stat /tmp/fifo
      File: "/tmp/fifo"
      Size: 0               Blocks: 0          IO Block: 4096   fifo
    Device: eh/14d  Inode: 68387       Links: 1
    Access: (0644/prw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2013-10-12 10:05:33.000000000
    Modify: 2013-10-12 10:05:33.000000000
    Change: 2013-10-12 10:05:33.000000000

    sh-#

  • 相关阅读:
    显示等待WebDriverWait
    MySQL添加注释
    linux
    linux时区问题
    CentOS禁用笔记本touchpad
    Mysql事务隔离级别
    IDEA集成有道翻译插件/maven帮助插件/mybatis插件
    SVN服务器的搭建和使用
    IntelliJ IDEA工具的安装使用
    IntelliJ IDEA的使用操作链接
  • 原文地址:https://www.cnblogs.com/james1207/p/3365961.html
走看看 - 开发者的网上家园