linux中type、file和stat的区别

type查看命令类型,例如该命令是alias,还是内置命令,还是某个文件

[root@localhost ~]# type ll
ll is aliased to `ls -l --color=auto'
[root@localhost ~]# type ls
ls is aliased to `ls --color=auto'
[root@localhost ~]# type cd
cd is a shell builtin                   //builtin内置命令

[root@localhost ~]# type for
for is a shell keyword              //keyword关键字

[root@localhost ~]# type useradd
useradd is /usr/sbin/useradd
[root@localhost ~]# type -a ls               //列出该命令的所有类型
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls

file查看文件类型,例如文本文件、二进制文件、管道文件、设备文件、链接文件

[root@localhost ~]# file /etc/hostname

/etc/hostname: ASCII text

[root@localhost ~]# file /dev/sda

/dev/sda: block special

[root@localhost ~]# file /dev/zero 

/dev/zero: character special

stat文件的属性,例如文件的名称,大小,权限,atime,ctime,mtime

[root@localhost ~]# stat /etc/hostname 
  File: '/etc/hostname'
  Size: 22              Blocks: 8          IO Block: 4096   regular file
Device: fd01h/64769d    Inode: 41323274    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:hostname_etc_t:s0
Access: 2019-09-07 11:18:21.596120828 +0800
Modify: 2019-01-28 06:39:26.670003780 +0800
Change: 2019-01-28 06:39:26.670003780 +0800
 Birth: -
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值