↑ ↓ select, Enter open, Esc close

Calculate the total size of all files of one type

Adjust the values, the command updates live
user@server
find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f -iname '*.mp4' -printf '%s\n' | awk '{s+=$1; n++} END {printf "%d Dateien, %.1f MB\n", n, s/1048576}'

Searches all files with the given extension (case insensitive) and prints their count and total size in MB. Helps decide whether cleaning up or offloading a file type is worth it.

Note: This counts the logical file size, the space actually allocated on disk may differ slightly.

Also searched as

  • how much space do all videos use
  • total size of all jpg files linux
  • disk usage by file extension
  • count files by extension

Related one-liners

All in Filesystem

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.