Can tree show file sizes?

QuestionsQuestions8 SkillsProDec, 17 2025
0257

Yes, Labby! The tree command can indeed show file sizes!

To display the size of each file, you can use the -s (for size) option with the tree command.

For example:

tree -s ~/project/digital_garden

This will show the size of files in bytes next to their names. If you want more human-readable sizes (like KB, MB, GB), you can combine it with the -h (human-readable) option:

tree -sh ~/project/digital_garden

Give it a try in your lab environment! You might not see much of a difference yet since your digital garden directories are currently empty, meaning files would show a size of 0. However, if you were to add some files later, these options would become quite useful.

0 Comments

no data
Be the first to share your comment!