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.