You're looking for command substitution: substitute the output of a command into a command line.
find $(mount |awk '{print $3}') -name "aaa" -print
This only works if the mount points don't contain any whitespace or *?\[
. This restriction is rarely a problem for mount points (but do make sure that you don't have mount points with space characters — the awk
command would not parse them correctly anyway).
You need to tell find
not to traverse mount points, otherwise find /
already traverses your whole system. Pass the -xdev
option.
find $(mount |awk '{print $3}') -xdev -name "aaa" -print
Note that you should probably not run find
on all the mounted filesystems, as there are filesystems for internal system use that can be quite large and contain a lot of files that you don't have permission to read (causing spurious error messages). Instead of getting the list of filesystems from mount
, get it from df
, which omits some of these filesystems.
find $(df -P |awk 'NR != 1 {print $6}') -xdev -name "aaa" -print
linux
, since you will be using find on psuedo-filesystems such asproc
andsysfs
.