ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
will search for the file with name yourfilename in the current directory listing the location in subdirectories relevant to the current directory.
You should really look at the man page of find since there are a lot of options you can use to find your files. Find is one of the basics in Linux, so it's best you get acquainted with it.
will search for the file with name yourfilename in the current directory listing the location in subdirectories relevant to the current directory.
You should really look at the man page of find since there are a lot of options you can use to find your files. Find is one of the basics in Linux, so it's best you get acquainted with it.
Kind regards,
Eric
This does not work.
To Test I did ...
find . -name 'ms01.log' ....no matches found.
To Test I did ...
find . -name 'ms01.log' ....no matches found.
Are you sure the file is supposed to be in the directory where you executed the command? Or in a subdirectory of that one? The point (.) means that it will only look in the current directory (where you run the command) and the subdirectories it holds.
Are you sure the file is supposed to be in the directory where you executed the command? Or in a subdirectory of that one? The point (.) means that it will only look in the current directory (where you run the command) and the subdirectories it holds.
If you want to look system wide then use:
Code:
find / -name 'ms01.log'
Kind regards,
Eric
when I run this system wide search ...I get many "Permission denied" message.
message is : find: cannot read dir directory_name_here Permission denied.
However, I just want to find the location of the file .
I can browse into the filesystem and can download this file using Filezilla easily !
can we get rid of those permission denied messages ? this is making the screen clumsy.
can we get rid of those permission denied messages ? this is making the screen clumsy.
Sure
Code:
find / -name 'ms01.log' 2>/dev/null
If you are looking for an ordinary file, not a directory, not a "special" file such as a "device file" etc., you can tell find using -type f. If you are not sure of the uppercase/lowercase file name you can tell find to ignore case by using -iname instead of name. Hence
Code:
find / -type f -iname 'ms01.log' 2>/dev/null
The find man page is one of the hardest to understand so you may be better off looking at a few examples before tackling the man page directly.
If you are looking for an ordinary file, not a directory, not a "special" file such as a "device file" etc., you can tell find using -type f. If you are not sure of the uppercase/lowercase file name you can tell find to ignore case by using -iname instead of name. Hence
Code:
find / -type f -iname 'ms01.log' 2>/dev/null
The find man page is one of the hardest to understand so you may be better off looking at a few examples before tackling the man page directly.
what is ' 2>/dev/null' ? is not 'dev' is a directory ? is 'null' also a directory ? I never heard a directory named 'null'! .....is it storing any file ?
I don't understand this ...can you please explain this part. I would like to test this command .
/dev/null is the 'bit bucket', the 'waste basket', 'the garbage can', and so on. When you give a 2>/dev/null at the end of a command you're redirecting (>) the error output to that waste basket instead of to 'stdout' (standard output which is your console).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.