please help

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers please help
# 1  
Old 12-19-2001
please help

Does anyone know the unix / linux code(use REDHAT and KSH) to count the number of occurences of a certain file it find
thx in advance
# 2  
Old 12-20-2001
Well, as I understand it, you want to find out how many files of a given name exists on the entire system...

Say you're counting the number of files named "" in the entire system:

find / -name | wc -l 2>/dev/null

You'll probably want the "2>/dev/null" on the end - it will take any errors and silently throw them away. This is especially helpfull if you run this as anormal user (not root).
Now say you want to find certain types of files in only your home directory:

find /your/home -name "*.sh" | wc -l

man find and man wc for more info... There's dozens of different way you can write your "find" to find very specific files...
# 3  
Old 12-20-2001

thanks a lot. Nice to know there is people out there willing to help. I wouldnt have thought of using the pipe
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question