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: -
本文详细介绍了在Linux环境中如何使用type命令检查各种命令的类型,包括别名、内置命令、关键字和路径关联的命令。同时,展示了如何利用file和stat命令来查看文件的类型和详细属性,如文本文件、二进制文件、设备文件等,以及文件的大小、权限、创建和修改时间等信息。
1487

被折叠的 条评论
为什么被折叠?



