Disk Space, Memory Use, and CPU Load: du, df, free, and w


It's often necessary to figure out how much space your files are using up, especially on smaller devices like the Raspberry Pi, where storage is frequently limited. This is where du (think disk usage, even though your "disk" is probably an SD card) comes in. By default, the output is pretty verbose and hard to read, so I usually use -h for human readable numbers with units and -s for a summary.
You can also specify a path, and without the -s it will tell you the size of every file it looks at.

df

Sometimes it's easier to come at the question by checking how much space is left on a drive.
df (disk free) provides a quick summary, broken out by device and where that device is attached to:

free

A resource even more constrained than storage on the Raspberry Pi is RAM. free provides a useful quick summary of the state of the computer's memory:
Again, -h gets you human-readable numbers with units. Here's a good breakdown of how to read those numbers.

w

It can also be useful to know who's logged in, the system's uptime, and CPU load average for the last 1, 5, and 15 minutes. That's the grab bag of info supplied by w:
You can also get just that first bit by running uptime.

What is load average?

That's kind of a tricky question. The first thing you need to know is that higher numbers mean more load. The second thing is that it matters how many processors you have - mentally divide the number you see by the number of processors, and that's the number you should worry about.
What's a number you should worry about? Well, it depends. Here's a good detailed explanation.

Followers

Comments

Page views