Running out of Disk Space - Can temporary files or junk be cleared out?

My one linode seems to have run out of space. It's caught me off guard a bit and I'll go and do some deletion and clean up and moving things around.

However, I was browsing the file structure and I was wondering whether there were temporary files or trash that could be emptied or deleted?

If so, how could I find that and remove it? I'm just wondering whether there is junk lying around. I see quite a few things when I do a df -h which read: tmpfs or devtmpfs - and I wondered if this was some indication of temporary files?

Thanks,
Jan

2 Replies

Hello,
TMPFS is a temporary file system in the ram. What you'd want to focus on for your disk space, assuming your Linode is running a standard configuration, is /dev/sda.

A few things you can check are log files in /var/log, something like this can check the size of this directory.

sudo du -hs /var/log

You can look in there for any old or outdated logs. Also, the systemd journal files may take up some space as well. If you don't review them, you can easily clear them. An example to clear all but the last ten days of logs:

sudo journalctl --vacuum-time=10d

I found an article here that can explain this in more detail.

Package cache is another thing to check. Any files under your user cache directory, typically something like /home/user/.cache. Any old unused packages could be removed, which would also free up space. Any files that are unused, which don't belong to any package, perhaps done as improper packaging or forgotten builds, could also be removed.

How to remove various files such as these are operating system depemdent, but some internet searches should be able to pull up any articles that may be helpful to your situation.

Good luck, and feel free to ask any further questions!

Blake

Stuff in /tmp and /var/tmp can be deleted immediately. To delete files, use the commands:

rm /tmp/*
rm /var/tmp/*

If you don't have sufficient privilege to delete a file, rm(1) will generate an error and the file will not be removed.

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct