Message board

Normal messages

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

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

 

 

Less
Copy link
Sticky messages
Advanced Pgpool-II Training
🕐 10-24-25 11:48
278 Views
Replies
News - PostgreSQL 18 released
🕐 10-20-25 21:55
106 Views
Replies
News - pgAdmin 4 v9.9 Released
🕐 10-20-25 21:53
74 Views
Replies
PostgresSolutions.com launches
🕐 03-11-25 11:42
745 Views
Replies