How do I find a file on my harddisk that starts with io_file?
I tried:
grep -r io_file*`
and
find -name io_file*
find did not return anything whereas grep seems to take ages without any results.
What am I doing wrong?
|
|
The command
will print commands after shell expansion so you can see what is going on
...and now you can see that the shell is expanding the argument to name into Quoting the pattern (double quotes work in this case also) will stop the shell expansion
To turn it off, use
You can also use
|
||||
|
|
|
The first parameter will specify where the search should start. The search string must be quoted if it contains a shell metacharacter, such as an asterisk. Otherwise, it will be parsed by the shell and never seen by |
|||||||||||||||
|
Keep in mind that grep and find do different things.
|
|||||||
|
|
The shell expands the wildcards and passes the result to grep, so you need to either escape the
All three of these do the same thing on my Linux box. |
|||
|
|
|
IMO, using find is slow for an entire harddrive search (it will also show you a lot of permission errors when accessing files you do not own). If possible, use locate:
You'll probably have to re-index if the file is newer than 24h (normally it sets a daily cronjob):
|
|||
|
|
|
The |
|||
|
|
|
Because you didn't give grep a file, it is operating on standard input and waiting for you to type something. It's the wrong command anyway. As for find you need a directory to start from and have to put
You can also use |
|||
|
|