From 85dcf3eef6259acc53ec80e025976267b3a8ae74 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 3 Aug 2016 12:05:22 +0100 Subject: [PATCH 1/3] tree.md: add more useful examples and reorder entries by increasing complexity --- pages/common/tree.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/common/tree.md b/pages/common/tree.md index 515b260328..b03a9e0c52 100644 --- a/pages/common/tree.md +++ b/pages/common/tree.md @@ -14,14 +14,14 @@ `tree -a` -- Print human readable size of files: +- Print the tree without indentation lines, showing the full path instead: -`tree -h` +`tree -i -f` -- Print the full path for each file: +- Print the size of each node next to it, in human-readable format, with folders displaying their cumulative size (as in the `du` command): -`tree -f` +`tree -s -h --du` -- Print the tree without lines and indentation. Useful when used with -f: +- Filter the tree using a wildcard (glob) pattern, showing only the hierarchies leading to the matching entries: -`tree -i` +`tree -P {{*.txt}} --prune` From 268af0f8a986d4108e7f71ca6999b4b54f0af688 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 3 Aug 2016 12:08:25 +0100 Subject: [PATCH 2/3] tree: use "levels" in the -L example description for improved mnemonics :) --- pages/common/tree.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/common/tree.md b/pages/common/tree.md index b03a9e0c52..bca11fc9b9 100644 --- a/pages/common/tree.md +++ b/pages/common/tree.md @@ -2,7 +2,7 @@ > Show the contents of the current directory as a tree. -- Show files and directories with a depth of 'num' (where 1 means the current directory): +- Show files and directories up to 'num' levels of depth (where 1 means the current directory): `tree -L {{num}}` From 31a07858ca2d010625499fb9e942f9c1371b339a Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 24 Aug 2016 17:09:58 +0100 Subject: [PATCH 3/3] split tree.md into linux and osx versions, to cater to the different sets of available options --- pages/linux/tree.md | 27 +++++++++++++++++++++++++++ pages/{common => osx}/tree.md | 6 +++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 pages/linux/tree.md rename pages/{common => osx}/tree.md (64%) diff --git a/pages/linux/tree.md b/pages/linux/tree.md new file mode 100644 index 0000000000..727d490d5e --- /dev/null +++ b/pages/linux/tree.md @@ -0,0 +1,27 @@ +# tree + +> Show the contents of the current directory as a tree. + +- Show files and directories up to 'num' levels of depth (where 1 means the current directory): + +`tree -L {{num}}` + +- Show directories only: + +`tree -d` + +- Show hidden files too: + +`tree -a` + +- Print the tree without indentation lines, showing the full path instead: + +`tree -i -f` + +- Print the size of each node next to it, in human-readable format: + +`tree -s -h` + +- Filter the tree using a wildcard (glob) pattern: + +`tree -P {{*.txt}}` diff --git a/pages/common/tree.md b/pages/osx/tree.md similarity index 64% rename from pages/common/tree.md rename to pages/osx/tree.md index bca11fc9b9..ab84aee677 100644 --- a/pages/common/tree.md +++ b/pages/osx/tree.md @@ -22,6 +22,10 @@ `tree -s -h --du` -- Filter the tree using a wildcard (glob) pattern, showing only the hierarchies leading to the matching entries: +- Find files within the tree hierarchy, using a wildcard (glob) pattern, and pruning out directories that don't contain matching files: `tree -P {{*.txt}} --prune` + +- Find directories within the tree hierarchy, pruning out directories that aren't ancestors of the wanted one: + +`tree -P {{directory_name}} --matchdirs --prune`