finding a file
i have to find a file somewhere on the system. I've used the find file but get permission denied (find / -name filename -print) and i also used grep. My text only gives me these two ways to find files, so I don't know if maybe i'm not using the right flags or something on the find command?
|
try the find command as root.
Also try the locate command. |
Try the "slocate <filename>" command, and it will give you a very comprehensive list indeed. It is also very fast, as it uses a small database, where it stores the details about the files.
|
actually i used find and found it mixed in all the lines of permission denied, but locate was one I found in my text also, thanx for you help tho, as I've entered these other commands in my growing notebook of notes :-)
|
The pemission denied messages are normal. If you're running as a normal user (and you should ;)) you're not allowed to access all files. The reasons vary from security issues to the privacy of other users at the system.
Something that gave me some problems with the find command: * you need to use wildcards, to indicate there can be something before or after the name. * the -name search is case-sensitive. Use -iname for incase-sensitive searching. For example: Code:
find /some/folder/ -iname "*file*" 'locate' uses a database created by 'updatedb'. In the crontab (or /etc/cron.*) folders, and "updatedb" is scheduelled to run every frequently. Grep can be used to filter text from a steam, file, or search for text in files. You can supply a regular-expression for more advanced pattern searching. for example: Code:
grep -E "\((WW|EE)\)" /var/log/XFree86.0.log Grep can be used to search multiple files: Code:
grep -i -R "some pattern" ...directories Code:
ps aux | grep kde edit: and to supress the error mesages: (redirect stderr;2 to /dev/null) Code:
find /some/folder/ -name ... 2>/dev/null |
i knew the exact name of the file, and i'm on a student server at school executing commands. He basically told us "create a symbolic link to filename, but you have to find it on your own", so I fished around until I found the way. Plus I have one of these "quick reference" card things and all the commands were right on there.
wow, I didnt expect so many responses at this hour, guess I'm not the only geek :D |
Well, it is the World-Wide web ;-)
|
;)
|
hmm.. someone should mention whereis, it searches your path for the binaryfile,manpages and lib
|
All times are GMT -5. The time now is 05:51 PM. |