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: -