Message board

Simple 1 liner to get sum of file sizes with ls or du Show less

JT wrote: 🕐 03-10-25 10:41

Want to see how big all your log files are? This is a simple one liner to do the trick.

 

ls -l *.log | awk '{print $5}' | awk '{total +=$1} END {print total}' | numfmt --to=iec $total

 

or use du

 

du -b *.log | awk '{total += $1} END {print total}' | numfmt --to=iec $total

Show less
Copy this message link
Generate partitions on the fly
🕐 02-28-25 12:23
61 Views
Replies
PostgreSQL Bloat explained
🕐 02-24-25 21:17
61 Views
Replies