Linux查看文件类型

2023-11-27 0 882

Linux系统中有七种文件类型,包括:普通文件类型目录文件块设备文件字符设备套接字文件管道文件链接文件,那么如何查看文件类型?本篇文章就为大家分享一下Linux查看文件类型的具体方法,有需要的小伙伴可以参考一下。

1  ls

ls -l  或者 ll (ls -l 别名)

 # ll anaconda-ks.cfg ? ? ? ? ? ? ? ? ? ? ? //看第一个字符
 -rw-------. 1 root root 2460 6月 ? 1 23:37 anaconda-ks.cfg

2  file 命令

 [root@xiaochen ~]# file anaconda-ks.cfg
 anaconda-ks.cfg: ASCII English text

3  stat 命令

stat 命令 查看文件ctime atime mtime

 # stat anaconda-ks.cfg
 ? File: ‘anaconda-ks.cfg’
 ? Size: 2592 ? ? ? Blocks: 8 ? ? ? ? ?IO Block: 4096 ? regular file
 Device: 803h/2051d Inode: 33574996 ? ?Links: 1
 Access: (0600/-rw-------) ?Uid: ( ? ?0/ ? ?root) ? Gid: ( ? ?0/ ? ?root)
 Access: 2018-09-20 05:57:35.329041552 +0800
 Modify: 2018-09-20 05:57:35.334041552 +0800
 Change: 2018-09-20 05:57:35.334041552 +0800
 ?Birth: -
 [root@master ~]# stat /dev/null
 ? File: ‘/dev/null’
 ? Size: 0 ? ? ? ? Blocks: 0 ? ? ? ? ?IO Block: 4096 ? character special file
 Device: 5h/5d Inode: 5930 ? ? ? ?Links: 1 ? ? Device type: 1,3
 Access: (0666/crw-rw-rw-) ?Uid: ( ? ?0/ ? ?root) ? Gid: ( ? ?0/ ? ?root)
 Access: 2019-01-21 16:27:54.255000135 +0800
 Modify: 2019-01-21 16:27:54.255000135 +0800
 Change: 2019-01-21 16:27:54.255000135 +0800
 ?Birth: -

以上就是良许教程网为各位朋友分享的Linux系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你!

本文来源:www.lxlinux.net/2522.html,若引用不当,请联系修改。

相关文章

猜你喜欢
官方客服团队

为您解决烦忧 - 24小时在线 专业服务

  • 0 +

    访问总数

  • 0 +

    会员总数

  • 0 +

    文章总数

  • 0 +

    今日发布

  • 0 +

    本周发布

  • 4975 +

    运行天数

你的前景,远超我们想象