-2

All discussions I read about report on commands to list large files on all the system. None of them helped me to solve the problem.

I have a half full root/

root@C:~#   df -Th
File system    Tipo      Dim. Usati Dispon. Uso% Mounted on
udev           devtmpfs  3,9G     0    3,9G   0% /dev
tmpfs          tmpfs     789M  9,6M    779M   2% /run
/dev/sda8      ext4       19G  9,8G    7,6G  57% /
tmpfs          tmpfs     3,9G   66M    3,8G   2% /dev/shm
tmpfs          tmpfs     5,0M  4,0K    5,0M   1% /run/lock
tmpfs          tmpfs     3,9G     0    3,9G   0% /sys/fs/cgroup
/dev/sda1      vfat      496M   65M    432M  14% /boot/efi
/dev/sda9      ext4      421G  108G    292G  27% /home
tmpfs          tmpfs     789M  108K    789M   1% /run/user/1000

However:

root@C:~# du -sch /root/*
68K /root/dmesg.txt
68K totale

There are hidden directories though:

root@C:~# echo .[^.]*
.aptitude .bash_history .bashrc .cache .config .dbus .gnupg .local .nano .profile .ssh .synaptic .wget-hsts

What is the command to get a proper list of them, to list all the heavy files and delete them?

Py-ser
  • 587
  • 2
  • 14
  • 28
  • 6
    You have a half-full `/` - that likely has very little to do with `/root` (which is just the home directory of user `root`) – steeldriver Feb 09 '18 at 01:26
  • If you're really concerned about large files, look into installing `baobab` as it can show you all the diskspace usage. `sudo apt install baobab` – Terrance Feb 09 '18 at 03:28
  • 1
    Do not delete anything just because it is a big file and you think you do not need it. There are enough calls for help here because someone deleted important system files and asks how to restore them. BTW your `/ ` is at 57% so it isn't full. – muclux Feb 09 '18 at 06:18
  • @steeldriver, thanks. it there a technical name for the `/` directory? So I can google for help. – Py-ser Feb 11 '18 at 03:02
  • 1
    I'd call it the *filesystem root directory* but I don't know if that's standard terminology. You could search for large files on it using something like `sudo find / -xdev -type f -size +100M -exec du -sh {} +` - see for example [What's a command line way to find large files/directories to remove and free up space?](https://askubuntu.com/questions/36111/whats-a-command-line-way-to-find-large-files-directories-to-remove-and-free-up) – steeldriver Feb 11 '18 at 03:11

1 Answers1

-1

Try this one (from path /root)

find $PWD -xdev -ls | awk '{print $7" \t"$11}' | sort -rn | less

It will show you all files at your current directory sorted from bigger ones to smaller ones.

dessert
  • 39,392
  • 12
  • 115
  • 163
  • This breaks on file or directory names with whitespaces. Btw, `find $PWD` isn't really necessary, `find` uses `$PWD` by default if no other path is given. A better alternative would be `du -ah . | sort -nr | less`. – dessert Feb 09 '18 at 08:25
  • 1
    @dessert When using `du -h` I also suggest using `sort -h`. – PerlDuck Feb 10 '18 at 11:42