Sujet : Re: Files tree
De : theise (at) *nospam* panix.com (Ted Heise)
Groupes : comp.os.linux.miscDate : 12. Apr 2024, 15:25:15
Autres entêtes
Organisation : My own, such as it is
Message-ID : <slrnv1ih2b.bhi.theise@panix2.panix.com>
References : 1 2 3
User-Agent : slrn/1.0.3 (NetBSD)
On Fri, 12 Apr 2024 14:15:49 -0000 (UTC),
Rich <
rich@example.invalid> wrote:
Ted Heise <theise@panix.com> wrote:
On Fri, 12 Apr 2024 13:39:34 +0100,
export LC_ALL=C
sudo find /\
-path "/proc/*" -prune -o\
-path "/run/*" -prune -o\
-path "/sys/*" -prune -o\
-path "/tmp/*/*" -prune -o\
-print0 | sort -z | tr '\0' '\n' > /tmp/f1
I know just enough linux admin to be dangerous so this is
probably a dumb question, but I'm wondering why use find
rather than ls?
Because 'find' is intended to be a filesystem traversal tool,
and it includes the ability to exclude parts of the tree (the
-path -prune invocations above exclude looking in those
sub-trees).
'ls' is meant to display directories to humans, and it has only
a rudimentary ability to walk the tree, and no ability to
exclude parts of the tree you don't want to see.
Okay, that makes sense. Thanks for helping educate me!
-- Ted Heise <theise@panix.com> West Lafayette, IN, USA