linux命令如何查看文件的属性?

linux命令如何查看文件的属性?,第1张

通过ll命令可以查看一个目录下的文件和子目录的属性和大小,以下面的例子讲解

[root@localhost ~]# ll

total 88

-rw-r--r-- 1 root root 1022 Feb 13 16:07 anaconda-ks.cfg

drwxr-xr-x 2 root root 4096 Feb 13 16:07 Desktop

-rw-r--r-- 1 root root 49229 Feb 13 16:07 install.log

-rw-r--r-- 1 root root 5133 Feb 13 16:06 install.log.syslog

-rw-r--r-- 1 root root 7 May 2 05:28 test

[root@localhost ~]#

我以其中一行讲解:

-rw-r--r-- 1 root root 1022 Feb 13 16:07 anaconda-ks.cfg

-rw-r--r-- 1 root root 1022这些都是文件的属性,包括文件的属主、属组和其他组的权限,属主和属组的名称,1022表示文件的大小,Feb 13 16:07是文件的修改时间。

至于被谁修改过是看不出来的。

1、简单的用命令看:

ls -al

2、C编程:

“#include <sys/stat.h>”

int stat(const 

char *restrict pathname, struct stat *restrict buf) //通过文件名称获取文件属性


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/7138372.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-02
下一篇 2023-04-02

发表评论

登录后才能评论

评论列表(0条)

保存