Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

with the following command:

    find /tmp  -depth -name file

I get the:


But what I need to add to find command in order to get the following print?

share|improve this question
up vote 3 down vote accepted

Maybe with the printf option:

find /tmp -depth -name "file" -printf "file=%h/%f\n"

share|improve this answer
What is the ampersand for? I get a literal one in the output. You could use %p instead of %h/%f. – Dennis Williamson Jan 25 '11 at 16:47
Don't know where the & comes from, must slipped in while editing the line ;) I somehow like separating path and filename, not exactly sure why, but yes, %p would also work. – Sven Jan 25 '11 at 16:54

Your Answer


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.