Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I run find, it outputs relative (./-based) file names, but I need full absolute (/-based) names.

share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

You should call find with absolute directories' names, for example:

find "$PWD"/ -iname '*.txt'
share|improve this answer
    
I'd advise quoting "$PWD" just in case. –  jw013 Mar 27 '12 at 21:11
1  
@jw013: oh, right. –  enzotib Mar 28 '12 at 7:17
add comment

@enzotib's answer is probably better but I use

find "`pwd`" -iname '*.txt'

because the lowercase letters and ` are easier for me to type.

share|improve this answer
    
Even so you should quote that: "`pwd`". Try it: mkdir '/tmp/foo bar' && cd !#:1 && find `pwd`; rmdir !#:1. –  janmoesen Mar 28 '12 at 11:47
add comment

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.