Open your terminal. Ever run du -sh and gotten confused? Or ls -la and lost track?
#DevTools #Linux #StorageManagement treefilesize Display directory tree with file sizes and total folder usage. Installation
treefilesize is essentially a wrapper script (bash, Python, or PowerShell) that traverses directories and outputs a tree where each file shows its size and directories show aggregated or individual sizes. treefilesize
import os def tree_filesize(start_path, indent=''): for item in sorted(os.listdir(start_path)): path = os.path.join(start_path, item) size = os.path.getsize(path) if os.path.isfile(path) else 0 size_str = f"size/1024:.1f KB" if size < 1024 1024 else f"size/(1024 1024):.1f MB" print(f"indent├── item (size_str)") if os.path.isdir(path): tree_filesize(path, indent + '│ ')
(more customizable):
Here’s a breakdown of content regarding — a conceptual or custom tool/script that visualizes file sizes in a tree structure, similar to tree but with file sizes included. 1. Blog Post / Tutorial: Title: Master Disk Usage with treefilesize : Visualize File Sizes Like a Pro
Or write your own Python script to color-code big files red. Open your terminal
Ever run tree and wished you could see file sizes right next to each item? Or used du -sh but missed the hierarchical clarity? Enter treefilesize — a simple but powerful command-line utility that displays directory structures along with human-readable file sizes.