linux 文件类型

来源:互联网 发布:梦幻网络盟重新城 编辑:程序博客网 时间:2024/06/04 18:32

linux 的文件类型主要有以下几种,在用ls -l显示

-:普通文件

l:连接文件

c:字符设备

d:目录

b:块文件

p:管道文件

s:socket文件


 除了用ls -l可以查看文件类型外在shell编程中还常用stat 命令来方便的取出文件各种属性值,

1. 所有属性

[root@hadoop ~]# stat go4.txt
  File: `go4.txt'
  Size: 11              Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 675874      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-02-14 01:47:02.196043596 -0500
Modify: 2013-09-29 01:38:17.809000173 -0400
Change: 2013-09-29 01:38:17.809000173 -0400

2. 只列出修改日期

[root@hadoop ~]# stat -c %y go4.txt
2013-09-29 01:38:17.809000173 -0400

3.只列出文件类型

[root@hadoop ~]# stat -c %F go4.txt
regular file

更细的可以使用file命令



0 0
原创粉丝点击