Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Trying to use locate command to find an exact match for the given pattern. However it results showing all matching files..

For example: I want to find a binary named: node

But it gives me all matches containing this word:

server2# locate node
/usr/share/man/man9/getnewvnode.9.gz
/usr/share/man/man9/ieee80211_amrr_node_init.9.gz
/usr/share/man/man9/ieee80211_dump_node.9.gz
/usr/share/man/man9/ieee80211_dump_nodes.9.gz
/usr/share/man/man9/ieee80211_find_rxnode.9.gz
/usr/share/man/man9/ieee80211_find_rxnode_withkey.9.gz
/usr/share/man/man9/ieee80211_free_node.9.gz
share|improve this question

1 Answer 1

up vote 1 down vote accepted

You may use grep with locate

server2# locate node | grep node$

The $ sign will tell grep to look at the end of the string.

share|improve this answer
    
Result is the same. It brings up different matches ending with node... /usr/ports/www/p5-WebService-Linode. I guess it should be /node$ ? –  Radio Sep 27 '12 at 13:40
    
Yes you can try this too (But I'm not sure if the / character must be escaped or not). Have you tried locate -b ? –  lracicot Sep 27 '12 at 13:43
    
haven't been such parameter ever. Fwd slashes don't need to be escaped. –  Radio Sep 27 '12 at 14:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.