Visit Our UNIX and Linux User Community


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 name.....is 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 "tmp.sh" in the entire system:

find / -name tmp.sh | 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

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

Previous Thread | Next Thread
Test Your Knowledge in Computers #245
Difficulty: Easy
In 1971, Ray Tomlinson, of BBN sent the first network e-mail.
True or False?

Featured Tech Videos