1

I want to keep only the last line of tree's output or the file+directory count report. Preferably, with the -a switch.

An example output I desire:

585 directories, 37722 files

Is this possible with tree?

3
  • 2
    Does this answer your question? How to display only the last line of a listing ?
    – phuclv
    Feb 6, 2023 at 1:20
  • @phuclv it does, but I'm looking to see if there's any combination of flags for tree that would skip listing. That would take some time if a directory is big.
    – Sepp A
    Feb 6, 2023 at 13:17
  • that'll need a different command and the question should be command to output file and directory count instead of tree command to only output file and directory count?. It's very simple to count in awk or perl
    – phuclv
    Feb 6, 2023 at 14:31

1 Answer 1

1

tail is a standard filter to print last line(s). To print one last line use tail -n 1.

tree -a | tail -n 1
1
  • Isn't there any combination of flags for tree that would do the same?
    – Sepp A
    Feb 6, 2023 at 12:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .