1
sudo du -h --max-depth=1


72K ./root
4.0K    ./cdrom
16G ./var
4.0K    ./media
5.9G    ./usr
146M    ./boot
12M ./etc
148K    ./tmp
13G ./home
16K ./opt
du: cannot access './run/user/1000/doc': Permission denied
du: cannot access './run/user/1000/gvfs': Permission denied
1.6M    ./run
4.0K    ./srv
4.8G    ./snap
16K ./lost+found
4.0K    ./mnt
0   ./dev
0   ./sys
du: cannot access './proc/9684/task/9684/fd/3': No such file or directory
du: cannot access './proc/9684/task/9684/fdinfo/3': No such file or directory
du: cannot access './proc/9684/fd/4': No such file or directory
du: cannot access './proc/9684/fdinfo/4': No such file or directory
0   ./proc
41G .

Which flies can I delete to free up disk space?

9
  • Welcome to AskUbuntu! Which release of Ubuntu you use ? Nov 27, 2021 at 7:51
  • Ubuntu 20.04 LTS
    – Avijit
    Nov 27, 2021 at 8:08
  • You can delete stuff in your /home/youruser/ folder but not the hidden folders within it. You can uninstall apps and snaps. You can search for tutorials about how to free up space such as this one itsfoss.com/free-up-space-ubuntu-linux
    – PonJar
    Nov 27, 2021 at 8:18
  • The largest directories you have are ´7var` and /home at 12G and 16G.Look into thes and see what large file and directories there are. In /var it is typical /var/log. Find out what logs that grows and the errors that makes them grow- Fix the errors and delete the old versions of the log-files - typically there are 3 to 5 versions of each logfile.
    – Soren A
    Nov 27, 2021 at 8:27
  • 1.3G ./.local/share/Trash/expunged/2726609749/rootfs 1.3G ./.local/share/Trash/expunged/2726609749 9.6G ./.local/share/Trash/expunged Can I delete all of them?
    – Avijit
    Nov 27, 2021 at 8:49

2 Answers 2

0

There's a number of things you can do:

  • Install BleachBit: deletes unnecessary files.
  • Remove old revisions of snaps.
  • Check further options in Ask Ubuntu.

Here's the code that you need to put in a shell script and run (2nd option):

#!/bin/bash
# Removes old revisions of snaps
# close all snaps before running this!!
     
set -eu
LANG=C snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
    snap remove "$snapname" --revision="$revision"
done
0

Maybe this will help some people. I just ran $ docker system prune -a on my work laptop and personal laptop and it cleared, respectively, 75 Gb and 50 Gb of disk space. Lots of Docker stuff hanging around apparently even though if I ran $ docker ps -a there was nothing there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .