One of the best answers to that question is that you pull out some tools that might help you figure out what is happening. Determining whether the disk space shortage is something that has been gradually creeping up on you or is in response to some serious problem that is plaguing your server right now can be of considerable benefit. But, if you haven't been routinely monitoring disk space usage, that's not an easy thing to figure out. Having a series of commands set up to help pinpoint the problem, on the other hand, might still help you identify the problem fairly quickly. Yeah, the Boy Scouts' "be prepared" motto works for system administrators too.
If there's any question about where your disk space shortage is coming from, a quick df -h will highlight the file system that has run out of room. This is pretty obvious, but is always a good place to start.
The output of the df command will show you how full each file system is, displaying the space used and available in the "human readable" format (e.g., 18G instead of 18710668). You can also get a little fancier with this command. Using -l (local), for example, you can omit file systems that are mounted from other systems.
You can also order the output of the sort command to list your file systems in percentage full order. In the sort command below, we're doing a numeric sort on the 5th field of the df output.
The du (disk used) command can then help you to focus on where, within the file system, that space is going. In the command below, we are looking at the largest directories within a particular file system.
What you probably will want to know, however, is not just which subdirectories are the largest, but which have recently grown. For this, you can add the --time option to du to sort your du output by the last update time.
You can also search for the largest files in a particular file system using a find command like this one:
Adjust the size parameter to something that works well on your system or you might have a lot more output than you care to comb through.
Note that looking both for large files and large subdirectories can be helpful because the problem plaguing your system could be that a single file (e.g., a log file) is growing more quickly than it should or that a series of files are being added to the system.
Once you've selected a series of commands that give you the view of your disk usage that works for you, committing them to aliases makes them easy to use even when you're under pressure. Add the aliases to your .bashrc or other start up file so that they're ready for use.
Using a function instead of an alias, on the other hand, makes it easy to set up your command to take an argument. That makes them considerably more flexible and useful.
Just don't do both (aliases and functions). Your aliases will take precedence over your functions if they have the same names.