5 ms·
> So on a command like 'find' on Linux, you probably always want -xdev in addition to -P. No, why? A default of -P is fine but a default of -xdev would mean yo
by jackewiehose 6y ago
> So on a command like 'find' on Linux, you probably always want -xdev in addition to -P.
No, why? A default of -P is fine but a default of -xdev would mean you couldn't search everything like find / ...
edit: Not sure where you got "physical" hierarchy. Here is the debian explanation of -P:
-P Never follow symbolic links. This is the default behaviour. When find examines or prints information a file,
and the file is a symbolic link, the information used shall be taken from the properties of the symbolic link
itself.
- mehrdadn 6y agoDo you really want to go down /dev and /proc and /mnt mounts with find /?
- BenjiWiebe 6y agoI do want to go down /mnt, /home and /var.
- mehrdadn 6y agoThen you can add them explicitly. And what about /proc and /dev? And /sys? And /run? You usually know which mounts you want to go into, but don't have a list of every single one you want to stay out of. Most people want a whitelist here, not a blacklist.
- the_pwner224 6y agoMost people don't want to give a thought to whitelists or blacklists, they just want to find the files relevant to them. Most people are using grep or another command piped from find, and doing 'sudo find /' (sudo to get rid of all the errors from /proc) is the easiest way to search everything. 99% of the time sys and proc and run and all that stuff won't even show up in the filtered results, and if something does, its an easy 'grep -v ^/sys' to exclude.
- colinhb 6y ago> Not sure where you got "physical" hierarchy. Here is the debian explanation of -P: What's the relationship between the letter P and the behavior of the option -P? Same for the letter L and the behavior of -L, and the letter H and the behavior of -H? That's the point the parent is making.
- yread 6y agoWhy would you do find / ... instead of locate ... ?
- usefulcat 6y agoProbably either because the locate database could be out of date, or because you want to do any number of things that find can do that locate can't (-mtime, -executable, -fstype, -links, etc).
- pnutjam 6y agoLocate requires a database that needs to be updated. Find does an actual search of the system.
- mehrdadn 6y agoI would be terrified if you wrote a script that used locate in place of find.