作者:kanney姜_958 | 来源:互联网 | 2023-05-16 08:11
This question already has an answer here:
这个问题在这里已有答案:
- Bash: Head & Tail behavior with bash script 3 answers
Bash:使用bash脚本3答案的头部和尾部行为
If I run ls folder | head
in a directory with a lot of files, the execution time is about 50 times faster than ls folder | tail
. Does the head
command stops ls
from executing wholy when it has enough (10) lines?
如果我运行ls文件夹|在一个包含大量文件的目录中,执行时间比ls文件夹快约50倍尾巴。当head命令有足够的(10)行时,head命令会阻止ls执行wholy吗?
I couldn't find the answer to this anywhere because "pipe to head" gives me tons of unrelated results on Google or here.
我无法在任何地方找到答案,因为“管道到头”在谷歌或这里给了我大量无关的结果。
If the answer is no, then is there a more efficient way to list only some files instead of running ls
completely and cutting the output with head
?
如果答案是否定的,那么是否有更有效的方法来列出一些文件,而不是完全运行ls并用头部切割输出?
2 个解决方案