7
1
I want to use find
for getting all simlinks and regular files. I can use the -type for these individually, and I can use -o to string them together, but I apparently can't do -type fl
.
Is there a way condense this command? It's pretty burdensome.
find -type l -name node-dev -exec ls -lah {} + -o -type f -name node-dev -exec ls -lah {} +
I would like to be able to run it without the -o
, like:
find -type lf -name node-dev -exec ls -lah {} +
The man page seems to indicate this isn't possible (it doesn't say anything about extra -type
flag arguments), but I thought I'd ask anyways and try to learn something.
Note the files have no guarantee of any kind of reasonable extension naming structure, so any regex based solutions probably won't work. Also, I could use the '!'
operator to exclude directories like this answer suggests, but I'd ideally like to exclude more than just directories from the search.
Ah, the edit to the 2nd one makes a lot more sense - I thought I was doing it wrong. What is that parenthesis grouping called so I can find out more about it? – Patrick M – 2014-01-15T15:42:21.057
1The paren's are meaningful to the shell, hence, escape them so that the shell doesn't strip them out.
man find
- the operator with first and highest precedence is the parenthesized expression; search on OPERATORS. The theory behind find is like most C and UNIX evaluation; a Boolean expression, evaluated from left to right, with 'short-circuiting' i.e. once a truth expression is determined (like "if (TRUE or anything else")). – Billy McCloskey – 2014-01-15T15:56:02.027