Message board

Normal messages

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
Sticky messages
Generate partitions on the fly
🕐 02-28-25 12:23
172 Views
Replies
this is a test
🕐 03-31-25 22:05
99 Views
Replies
PostgreSQL Bloat explained
🕐 02-24-25 21:17
128 Views
Replies