Submit Next Question. By signing up, you agree to our Terms of Use and Privacy Policy. Forgot Password? This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy.
Find Command in Unix. Popular Course in this category. Course Price View Course. It is much faster than find , but is only as up-to-date as the last time the database was refreshed. If you know you have a file called book1. If all you know for sure is that the filename contains the word book , you can generate a likely much larger list with.
The argument to -name is a shell glob pattern. From the directory the file is in, compare:. This represents the kind of search performed by -name. The -iname option simply allows a case-insensitive version of this. In my testing, this seems to be faster than using find , and it also produces little to no user permission errors when run without root permission.
See manual. This form would take care of the 3 points of your scenario iregex is a case insensitive rational expression, and the pattern with. Remember however that Unix permissions apply: if the file is in a directory for which the user running the find command has no access execute right, find will not be able to find it there.
Silver Searcher is a very fast and handy util to search for files and content. If locate is not available, you can use find instead. It tend to be much slower, but also much more precise. If you have multiple partitions and you don't know on which one the file is on, you can get a list with lsblk on Linux-based OSes, parsing df output is an option otherwise and feed that into find: root again if you don't know if you can access the file.
This is a bit fragile if any of your mountpoints have spaces in df parameters might need tuning. Other versions might have other parameters or need it left out. Read your man page. This also assumes a bourne-like shell ksh and bash should work. If you are using a csh variant, start up a scriptable shell before you try this. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Learn more. How to find a file from any directory Ask Question. Asked 4 years, 8 months ago. Active 1 year, 10 months ago. Viewed k times. Psssst: How do I run a network as administrator? Entradas relacionadas: How do you find the occurrence of a word in Unix? How do I grep multiple patterns in Unix? How do I grep a string in a file in Unix? How do I find a specific pattern in a Unix file?
How do I find a particular record in Unix? How do you grep a string in Unix? How do you find the first two lines of a file in Unix?
Related Articles. How do I know my mobile operating system? How do I delete a second operating system in Windows 10?
0コメント