âfindâ exclude by fstype strange behavior
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I try to have "find" command exclude "/proc" filesystem.
I would prefer a portable solution to be able to use it on non GNU based hosts (oldest AIX for instance, where "find" do not have the "-path" option)
Here's what I've tried (on a Linux host) and a partial filtered output:
$ find / ! -fstype proc >/dev/null
find: `/proc/9475/task/9535/fdinfo/7': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15663': No such file or directory
etc ....
I don't understand why "find" keep walking inside the "/proc" file system despite of the "! -fstype proc" switch?
filesystems find proc
New contributor
add a comment |Â
up vote
2
down vote
favorite
I try to have "find" command exclude "/proc" filesystem.
I would prefer a portable solution to be able to use it on non GNU based hosts (oldest AIX for instance, where "find" do not have the "-path" option)
Here's what I've tried (on a Linux host) and a partial filtered output:
$ find / ! -fstype proc >/dev/null
find: `/proc/9475/task/9535/fdinfo/7': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15663': No such file or directory
etc ....
I don't understand why "find" keep walking inside the "/proc" file system despite of the "! -fstype proc" switch?
filesystems find proc
New contributor
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I try to have "find" command exclude "/proc" filesystem.
I would prefer a portable solution to be able to use it on non GNU based hosts (oldest AIX for instance, where "find" do not have the "-path" option)
Here's what I've tried (on a Linux host) and a partial filtered output:
$ find / ! -fstype proc >/dev/null
find: `/proc/9475/task/9535/fdinfo/7': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15663': No such file or directory
etc ....
I don't understand why "find" keep walking inside the "/proc" file system despite of the "! -fstype proc" switch?
filesystems find proc
New contributor
I try to have "find" command exclude "/proc" filesystem.
I would prefer a portable solution to be able to use it on non GNU based hosts (oldest AIX for instance, where "find" do not have the "-path" option)
Here's what I've tried (on a Linux host) and a partial filtered output:
$ find / ! -fstype proc >/dev/null
find: `/proc/9475/task/9535/fdinfo/7': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10856': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/10858': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15650': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15654': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15656': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15657': No such file or directory
find: `/proc/15663': No such file or directory
etc ....
I don't understand why "find" keep walking inside the "/proc" file system despite of the "! -fstype proc" switch?
filesystems find proc
filesystems find proc
New contributor
New contributor
New contributor
asked 2 hours ago
Gilles Pion
111
111
New contributor
New contributor
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
The -fstype
directive tells find
not to return any results that are on that filesystem type. That, however, doesn't mean that it won't look at the proc filesystem. It simply means that it won't return files found there, but it still needs to go through it in case it finds a file there whose fstype isn't proc. For instance, on my Arch, I find:
$ find /proc ! -fstype proc -printf '%p %Fn' 2>/dev/null
/proc/sys/fs/binfmt_misc binfmt_misc
/proc/sys/fs/binfmt_misc/CLR binfmt_misc
/proc/sys/fs/binfmt_misc/register binfmt_misc
/proc/sys/fs/binfmt_misc/status binfmt_misc
Those are 4 files in /proc
whose fstype is binfmt_misc
.
So, with this in mind, note that your question only shows error messages. None of those files have actually been returned by find
, so it would seem to be behaving as expected.
instead of "won't return files found there" maybe "won't return files of type proc that are found there" ?
â Jeff Schaller
13 mins ago
add a comment |Â
up vote
2
down vote
As terdon explained, find
will still enter the /proc
directory, but it will not return any pathnames from that filesystem type.
To remove any search path as soon as the proc
filesystem type is detected, use
find / -fstype proc -prune -o -print
However, since you're wanting to do this on an old find
, the -fstype
option may not be available. If -path
(a standard option of find
) is also not available, then it begins to be a bit difficult to come with suggestions as the implementation is clearly not POSIX compliant.
One option could be to use -xdev
which would cause find
to stay strictly in the same filesystem as the starting path. You would then have to run one find
for each filesystem that you want to examine. There could also be an option called -x
(as on BSD systems) which acts like -xdev
.
If that too is not possible, then you may have to resort to using -type d -name proc -prune
to remove all directories that are called proc
.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
The -fstype
directive tells find
not to return any results that are on that filesystem type. That, however, doesn't mean that it won't look at the proc filesystem. It simply means that it won't return files found there, but it still needs to go through it in case it finds a file there whose fstype isn't proc. For instance, on my Arch, I find:
$ find /proc ! -fstype proc -printf '%p %Fn' 2>/dev/null
/proc/sys/fs/binfmt_misc binfmt_misc
/proc/sys/fs/binfmt_misc/CLR binfmt_misc
/proc/sys/fs/binfmt_misc/register binfmt_misc
/proc/sys/fs/binfmt_misc/status binfmt_misc
Those are 4 files in /proc
whose fstype is binfmt_misc
.
So, with this in mind, note that your question only shows error messages. None of those files have actually been returned by find
, so it would seem to be behaving as expected.
instead of "won't return files found there" maybe "won't return files of type proc that are found there" ?
â Jeff Schaller
13 mins ago
add a comment |Â
up vote
3
down vote
The -fstype
directive tells find
not to return any results that are on that filesystem type. That, however, doesn't mean that it won't look at the proc filesystem. It simply means that it won't return files found there, but it still needs to go through it in case it finds a file there whose fstype isn't proc. For instance, on my Arch, I find:
$ find /proc ! -fstype proc -printf '%p %Fn' 2>/dev/null
/proc/sys/fs/binfmt_misc binfmt_misc
/proc/sys/fs/binfmt_misc/CLR binfmt_misc
/proc/sys/fs/binfmt_misc/register binfmt_misc
/proc/sys/fs/binfmt_misc/status binfmt_misc
Those are 4 files in /proc
whose fstype is binfmt_misc
.
So, with this in mind, note that your question only shows error messages. None of those files have actually been returned by find
, so it would seem to be behaving as expected.
instead of "won't return files found there" maybe "won't return files of type proc that are found there" ?
â Jeff Schaller
13 mins ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
The -fstype
directive tells find
not to return any results that are on that filesystem type. That, however, doesn't mean that it won't look at the proc filesystem. It simply means that it won't return files found there, but it still needs to go through it in case it finds a file there whose fstype isn't proc. For instance, on my Arch, I find:
$ find /proc ! -fstype proc -printf '%p %Fn' 2>/dev/null
/proc/sys/fs/binfmt_misc binfmt_misc
/proc/sys/fs/binfmt_misc/CLR binfmt_misc
/proc/sys/fs/binfmt_misc/register binfmt_misc
/proc/sys/fs/binfmt_misc/status binfmt_misc
Those are 4 files in /proc
whose fstype is binfmt_misc
.
So, with this in mind, note that your question only shows error messages. None of those files have actually been returned by find
, so it would seem to be behaving as expected.
The -fstype
directive tells find
not to return any results that are on that filesystem type. That, however, doesn't mean that it won't look at the proc filesystem. It simply means that it won't return files found there, but it still needs to go through it in case it finds a file there whose fstype isn't proc. For instance, on my Arch, I find:
$ find /proc ! -fstype proc -printf '%p %Fn' 2>/dev/null
/proc/sys/fs/binfmt_misc binfmt_misc
/proc/sys/fs/binfmt_misc/CLR binfmt_misc
/proc/sys/fs/binfmt_misc/register binfmt_misc
/proc/sys/fs/binfmt_misc/status binfmt_misc
Those are 4 files in /proc
whose fstype is binfmt_misc
.
So, with this in mind, note that your question only shows error messages. None of those files have actually been returned by find
, so it would seem to be behaving as expected.
answered 2 hours ago
terdonâ¦
123k28233407
123k28233407
instead of "won't return files found there" maybe "won't return files of type proc that are found there" ?
â Jeff Schaller
13 mins ago
add a comment |Â
instead of "won't return files found there" maybe "won't return files of type proc that are found there" ?
â Jeff Schaller
13 mins ago
instead of "won't return files found there" maybe "won't return files of type proc that are found there" ?
â Jeff Schaller
13 mins ago
instead of "won't return files found there" maybe "won't return files of type proc that are found there" ?
â Jeff Schaller
13 mins ago
add a comment |Â
up vote
2
down vote
As terdon explained, find
will still enter the /proc
directory, but it will not return any pathnames from that filesystem type.
To remove any search path as soon as the proc
filesystem type is detected, use
find / -fstype proc -prune -o -print
However, since you're wanting to do this on an old find
, the -fstype
option may not be available. If -path
(a standard option of find
) is also not available, then it begins to be a bit difficult to come with suggestions as the implementation is clearly not POSIX compliant.
One option could be to use -xdev
which would cause find
to stay strictly in the same filesystem as the starting path. You would then have to run one find
for each filesystem that you want to examine. There could also be an option called -x
(as on BSD systems) which acts like -xdev
.
If that too is not possible, then you may have to resort to using -type d -name proc -prune
to remove all directories that are called proc
.
add a comment |Â
up vote
2
down vote
As terdon explained, find
will still enter the /proc
directory, but it will not return any pathnames from that filesystem type.
To remove any search path as soon as the proc
filesystem type is detected, use
find / -fstype proc -prune -o -print
However, since you're wanting to do this on an old find
, the -fstype
option may not be available. If -path
(a standard option of find
) is also not available, then it begins to be a bit difficult to come with suggestions as the implementation is clearly not POSIX compliant.
One option could be to use -xdev
which would cause find
to stay strictly in the same filesystem as the starting path. You would then have to run one find
for each filesystem that you want to examine. There could also be an option called -x
(as on BSD systems) which acts like -xdev
.
If that too is not possible, then you may have to resort to using -type d -name proc -prune
to remove all directories that are called proc
.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
As terdon explained, find
will still enter the /proc
directory, but it will not return any pathnames from that filesystem type.
To remove any search path as soon as the proc
filesystem type is detected, use
find / -fstype proc -prune -o -print
However, since you're wanting to do this on an old find
, the -fstype
option may not be available. If -path
(a standard option of find
) is also not available, then it begins to be a bit difficult to come with suggestions as the implementation is clearly not POSIX compliant.
One option could be to use -xdev
which would cause find
to stay strictly in the same filesystem as the starting path. You would then have to run one find
for each filesystem that you want to examine. There could also be an option called -x
(as on BSD systems) which acts like -xdev
.
If that too is not possible, then you may have to resort to using -type d -name proc -prune
to remove all directories that are called proc
.
As terdon explained, find
will still enter the /proc
directory, but it will not return any pathnames from that filesystem type.
To remove any search path as soon as the proc
filesystem type is detected, use
find / -fstype proc -prune -o -print
However, since you're wanting to do this on an old find
, the -fstype
option may not be available. If -path
(a standard option of find
) is also not available, then it begins to be a bit difficult to come with suggestions as the implementation is clearly not POSIX compliant.
One option could be to use -xdev
which would cause find
to stay strictly in the same filesystem as the starting path. You would then have to run one find
for each filesystem that you want to examine. There could also be an option called -x
(as on BSD systems) which acts like -xdev
.
If that too is not possible, then you may have to resort to using -type d -name proc -prune
to remove all directories that are called proc
.
edited 51 mins ago
answered 58 mins ago
Kusalananda
107k14209331
107k14209331
add a comment |Â
add a comment |Â
Gilles Pion is a new contributor. Be nice, and check out our Code of Conduct.
Gilles Pion is a new contributor. Be nice, and check out our Code of Conduct.
Gilles Pion is a new contributor. Be nice, and check out our Code of Conduct.
Gilles Pion is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471611%2ffind-exclude-by-fstype-strange-behavior%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password