简体   繁体   English

在Linux中的父目录下显示文件和文件夹详细信息

[英]Display the Files and Folder details under a parent directory in Linux

I have to display all files and folders details under a parent directory. 我必须在父目录下显示所有文件和文件夹的详细信息。 I am using the command is 'find'. 我正在使用的命令是“查找”。 For example, 例如,

find /usr/local

/usr/local/bin

It's display only the file name. 它仅显示文件名。 I have to display file name with details about files like below. 我必须显示文件名,并包含有关以下文件的详细信息。 Means I have to add below information in the above result set. 意味着我必须在上述结果集中添加以下信息。

-rw-rw-- 1 hduser hduser 213 jan 22 11:51

How to do it? 怎么做?

Thanks in advance. 提前致谢。

There's the convenient action -ls : 有方便的动作-ls

find /usr/local -ls

If you need some other than the default -ls output format, the action -printf is appropriate; 如果您需要默认的-ls输出格式以外的其他格式,则操作-printf是合适的; with that you can freely define the format, eg: 这样您就可以自由定义格式,例如:

find /usr/local -printf "%i,%k,%M,%n,%u,%g,%s,%t,%p\n"

Cf. cf. man find : Print File Information . man find :打印文件信息

you can use below command to list it nicely in a order and block wise:- 您可以使用以下命令将其按顺序很好地列出,并按块明智:-

find . -type d |xargs ls -ltr

For your case:- 对于您的情况:-

find /usr/local -type d |xargs ls -ltr

尝试sudo find /usr/local -name "filename" -depth -exec ls -ll {} \\;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM