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?

Avijit
  • 11

2 Answers2

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

alper
  • 222
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.