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.

What is the command to find a jar file in a particular folder?

Say I want to find log4j.jar in the /dev directory, what command should I use?

share|improve this question

1 Answer 1

You can use find. In your case:

find /dev/ -name log4j.jar

You can also use wildcards, for example

find /dev/ -name \*.jar

would find all .jar files under /dev.

Note that find does the search resursively, i.e. searches all subfolders of /dev, too. You can adjust the maximal depth of your search using the -maxdepth parameter, see man find for more details.

Note also that in your case you should perhaps have root permissions because not all subfolders in /dev are readable by all users. In a debian/ubuntu system you could just add a sudo before the find command.


If you don't want to search resursively you could just use ls for example

ls /dev/*jar

will list all jar files under /dev.

share|improve this answer
    
Already used this command but not working –  Cindrella Aug 8 '12 at 9:33
7  
@Mohini: "not working" is not very descriptive, we can't guess how it is failing for you. Also, having a .jar file in /dev would be very, very non-conventional. If the above commands don't return anything, it means the file is not there. –  Mat Aug 8 '12 at 9:36
    
You could try it searching a file you know it is in /dev –  student Aug 8 '12 at 9:38
    
i have already downloaded those files from the path and used find command but still find command is not showing the path. –  Cindrella Aug 8 '12 at 9:45
2  
Is the file really in /dev or ~/dev? In other words, is the file somewhere under your home directory? Using find to search the wrong directory won't return what you expect. –  ephsmith Aug 8 '12 at 11:02

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.