There are several ways to check which files take up the most space on your Linux server. One of the simplest and most useful is to run the following command over SSH:
Additional information
You can find more information about accessing your server over SSH in the article: Access Linux over SSH
du -h / | grep ^[0-9].GThis simple command will display all files that are at least 1GB in size.
Explanation of the parameters
- -h: Displays file sizes in a human-readable format (kilobytes, megabytes, etc.)
- /: This symbol means that the search starts at the server's root directory. You can specify a path to search within folder "x".
For example, this command would display all files that are at least 1GB in size within the folder /var/www/vhost/tunombrededominio.com:
du -h /var/www/vhost/tunombrededominio.com | grep ^[0-9].G- |: Makes the second command after this symbol use the results of the first command.
- grep: Searches for the pattern specified after the command
- ^: When used outside brackets, indicates that search results must start with the symbol following this character
- [0-9]: Indicates that the character in this position must be a number between 0-9
- .: Each dot matches one character (except a newline)
- G: Represents the gigabyte size unit. You can also use “K” for kilobyte or “M” for megabyte.
For detailed information about all the parameters available for "du", you can use the command:
man du