In Linux, here are some commonly used commands:
1. Using the ls command
You can use the ls command with the -lh option to check the file size, including compressed files. For example:
ls -lh filename.zip
Here, the -l option displays file information in a list format, and the -h option makes the file size display in a human-readable format (like KB, MB).
2. Using the du command
If you want to check the size of a compressed file without extracting it, you can use the du command. For example:
du -h filename.zip
Here, the -h option also makes the output size display in a human-readable format.
3. Using the stat command
The stat command can also be used to check the size of a file, including compressed files:
stat filename.zip
In the output, look for the “Size” field, which shows the file size (in bytes).
4. Using the file command to check compressed file type and size
Although the file command is primarily used to identify file types, it can also be used to check file size:
file filename.zip
This will display the file type and size. For example, the output might look like:
filename.zip: Zip archive data, at least v2.0 to extract, compression method=deflate
5. Using du and find to check the size of all compressed files in a specific directory
If you want to check the total size of all compressed files in a directory, you can use:
du -ch /path/to/directory/*.zip
Here, the -c option will display the total, while the -h option makes the output more readable.
Choose the command that suits your needs to check the size of compressed files. These methods are not limited to .zip files but also apply to other types of compressed files (like .tar.gz, .tar.bz2, etc.). Just replace the filename in the command with the corresponding compressed file name. If you are using a graphical file manager, such as Nautilus or Dolphin, you can usually check the file size in the file properties. Using these commands in the terminal is often more direct and efficient.
End.