Friday, May 19, 2023
HomeSoftware EngineeringThe best way to Rely Recordsdata in Listing on Linux

The best way to Rely Recordsdata in Listing on Linux

If it is advisable rely what number of recordsdata are in a listing on Linux, then you should utilize a mixture of the ls command to checklist all of the recordsdata, and the wc command to rely what number of traces are printed:

Possibility 1 – Utilizing wc

ls | wc -l

You’ll be able to specify a listing as follows:

ls <listing> | wc -l

Possibility 2 – Utilizing discover

You’ll be able to rely recordsdata recursively through the use of the discover command:

discover <listing> -type f | wc -l

Possibility 3 – Utilizing tree

Utilizing the tree command will print out the quantity of directories and recordsdata discovered, but when utilized in a big listing, then this may print a variety of output to the display, so watch out with this one.


This command won’t rely hidden recordsdata, so add the -a attribute to incorporate them:

tree -a <listing>


Please enter your comment!
Please enter your name here

Most Popular

Recent Comments