To check the size of a folder in Debian, you can use the du (disk usage) command, which is commonly available in most Unix-like operating systems. Here’s a step-by-step guide on how to do it:
Navigate to the Directory: If the folder is not in your home directory, navigate to the directory containing the folder using the cd command. For example:
cd /path/to/directory
Use the du Command: To check the size of a specific folder, use the du command followed by the -sh options and the folder name:
du -sh foldername
-s stands for “summarize”, which means it will only show the total size for each argument.
-h stands for “human-readable”, which makes the output easier to understand by using B (bytes), K (kilobytes), M (megabytes), G (gigabytes), etc.
For example, if you want to check the size of a folder named Documents in the current directory, you would use:
du -sh Documents
This command will display the total size of the folder in a human-readable format. If you want to see the size of all directories and subdirectories within a specific folder, you can omit the -s flag:
du -h foldername
This will list the sizes of all subdirectories recursively within the specified folder.
Use the du Command: To list the sizes of all directories within the current directory, you can use:
du -h --max-depth=1
-h makes the output human-readable (e.g., using K, M, G for kilobytes, megabytes, gigabytes).
--max-depth=1 tells du to show the size of the folders at one level below the current directory only.
This command will give you the size of each directory in the specified directory, not venturing deeper than one subdirectory level. If you want to see the sizes of all subdirectories recursively, you can adjust the --max-depth parameter to the depth you need, or omit it entirely to see all levels:
du -h