linux中type 、file、stat三者的区别

1、type

用来查看命令类型,以区别是内部命令还是外部命令

示例:[root@localhost ~]# type cd
   cd 是 shell 内嵌
     [root@localhost ~]# type ls
     ls 是 `ls --color=auto' 的别名
     [root@localhost ~]# type ifconfig
     ifconfig 是 /usr/sbin/ifconfig
注:用compgen  -b命令可以显示出shell的内置命令。

2、file

用来探测给定文件的类型。
示例: [root@localhost ~]# file 123.txt
      123.txt: ASCII text
      [root@localhost ~]# file file900
      file900: empty
      [root@localhost ~]# file zz1
      zz1: ASCII text


3、stat

主要用于显示文件或文件系统的详细信息
示例:[root@localhost ~]# stat zz1
        文件:"zz1"
        大小:34            块:8          IO 块:4096   普通文件
     设备:fd00h/64768d    Inode:33756248    硬链接:1
     权限:(0644/-rw-r--r--)  Uid:(    0/    root)   Gid:(    0/    root)
     环境:unconfined_u:object_r:admin_home_t:s0
     最近访问:2019-07-23 20:14:34.154503570 +0800
     最近更改:2019-07-22 19:44:58.883625984 +0800
     最近改动:2019-07-22 19:44:58.883625984 +0800
     创建时间:-

猜你喜欢

转载自www.cnblogs.com/zjz20/p/11234286.html