Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
cancel
Showing results for 
Search instead for 
Did you mean: 

count command.

SOLVED
Go to solution
someone_4
Honored Contributor

count command.

I have a dir /var/sendmail
this is where all the sendmail user files are stored. I is there a count command that I can run that tells me how many files i have in that dir ?
2 REPLIES
Pedro Sousa
Honored Contributor
Solution

Re: count command.

Hi!
ll /var/sendmail |wc -l
Rob Smith
Respected Contributor

Re: count command.

Hi, if you are looking for just files and not directories then issue this command from the directory in which you want to count:
ls -l | grep "^-" | wc -l
or
ls -l | wc -l if you want everything.
If by chance you want just directories then:
ls -l | grep "^d" | wc -l
Hope this helps.
Rob




Learn the rules so you can break them properly.