nickapos blog

Sunday, November 29, 2015

Adding a list of numbers in linux command line

Lets say, that you want to see how much space a specific set of files take in the disk. You need to add their sizes. How do you do that using command line?
Easy: ls -l *052015|awk '{s+=$5}END { print s}'

This will sum the size of backups made in May 2015 and return the total. Neat eh?
Posted by nickapos at 2:05 AM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: Technology
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

About Me

My photo
nickapos
View my complete profile

Blog Archive

  • ►  2020 (7)
    • ►  December (2)
    • ►  November (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2019 (3)
    • ►  August (1)
    • ►  April (1)
    • ►  March (1)
  • ►  2018 (2)
    • ►  October (2)
  • ►  2017 (6)
    • ►  December (1)
    • ►  September (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2016 (48)
    • ►  December (2)
    • ►  November (3)
    • ►  October (7)
    • ►  September (1)
    • ►  August (2)
    • ►  July (8)
    • ►  June (1)
    • ►  May (5)
    • ►  April (10)
    • ►  March (7)
    • ►  January (2)
  • ▼  2015 (25)
    • ►  December (2)
    • ▼  November (1)
      • Adding a list of numbers in linux command line
    • ►  October (1)
    • ►  September (1)
    • ►  August (2)
    • ►  July (1)
    • ►  June (1)
    • ►  May (2)
    • ►  April (3)
    • ►  March (3)
    • ►  February (1)
    • ►  January (7)
  • ►  2014 (25)
    • ►  December (7)
    • ►  November (6)
    • ►  October (12)
Simple theme. Powered by Blogger.