The compsize command is a utility in Linux that is used to calculate and display the compression ratios of files in a btrfs filesystem. The compsize command reads the specified filesystem and calculates the compression ratio of each file in the filesystem, displaying the results in a table.
To calculate the compression ratios of all files in the current filesystem, use the following command:
# compsize .
This will display the compression ratios of all files in the current filesystem in a table.
compsize Command Examples
1. Calculate the current compression ratio for a file or directory:
# sudo compsize path/to/file_or_directory
2. Don’t traverse filesystem boundaries:
# sudo compsize --one-file-system path/to/file_or_directory
3. Show raw byte counts instead of human-readable sizes:
# sudo compsize --bytes path/to/file_or_directory