bash 如何使用 find -ls 命令仅列出文件而不列出文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26648536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 11:40:32  来源:igfitidea点击:

how to use find -ls command to list only files and not folders?

bashshellfindls

提问by Oritteropus

I've filled the space on my quota on a shared server, I'm not aware how this could have happen and I suppose it depends on something that has been stored in some hidden folder by one of my analyses (now I have to find where..). What is strange is that according to 'du -csh' the sum of the size of my folders is much lower than what it says 'quota'. I would need to list all files in the server with their size, ownership and directory. Running find -ls from the root folder makes the job, however it also lists all folders and subfolders

我已经填满了共享服务器上配额的空间,我不知道这是怎么发生的,我想这取决于我的分析之一存储在某个隐藏文件夹中的东西(现在我必须找到在哪里..)。奇怪的是,根据“du -csh”,我的文件夹大小的总和远低于它所说的“配额”。我需要列出服务器中的所有文件及其大小、所有权和目录。从根文件夹运行 find -ls 可以完成这项工作,但它也会列出所有文件夹和子文件夹

Is there anyway to only list files? I need to list also all files in hidden folders, many thanks

无论如何只能列出文件吗?我还需要列出隐藏文件夹中的所有文件,非常感谢

回答by HardGlory

Answering on your main question:

回答你的主要问题:

ls -p | grep -v / 

Looks like you have another problem. Please run

看起来你有另一个问题。请跑

lsof | grep deleted

When you see some strings, just restart services which is locked this files.

当您看到一些字符串时,只需重新启动锁定此文件的服务即可。