Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
175 views
in Technique[技术] by (71.8m points)

command line - how to list file in a folder with millions of file in linux?

I have a folder in Linux with 15M files and I want to list the first 5 files. I was trying the following command:

ls -lart | head -5

However, this does not work and stuck for a long time. What would be the alternate way?

Also how to find out how many files are there in this directory? As I see using commands like the following is stuck for a long time as well.

ls -lart | wc -l

Also if I have to copy all these files from one folder to another what would be the option.

cp -pR *.txt another_folder?

question from:https://stackoverflow.com/questions/65843477/how-to-list-file-in-a-folder-with-millions-of-file-in-linux

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...