Comments on: How to Find Most Used Disk Space Directories and Files in Linux https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Thu, 20 Jul 2023 06:45:28 +0000 hourly 1 By: May https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/comment-page-1/#comment-1956554 Fri, 03 Feb 2023 11:04:32 +0000 http://www.tecmint.com/?p=18279#comment-1956554 In reply to Ed.

We also found deleted files that were still locked by some process:

$ sudo lsof | grep deleted
]]>
By: Gilles PION https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/comment-page-1/#comment-1915274 Wed, 16 Nov 2022 10:29:20 +0000 http://www.tecmint.com/?p=18279#comment-1915274 In reply to Gilles PION.

@Ravi Sorry for replying here; the “reply link” is missing from your latest comment.

> “but the command giving an error, see below”

sorry again, remove the "*" from "xargs du -s *".
The fixed command is :

$ find $HOME -mindepth 1 -maxdepth 1 -type d | xargs du -s | sort -rn | awk '{system("ls -ld " $2) ; exit}'

]]>
By: Ravi Saive https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/comment-page-1/#comment-1915254 Wed, 16 Nov 2022 09:35:09 +0000 http://www.tecmint.com/?p=18279#comment-1915254 In reply to Gilles PION.

@Gilles,

Thanks again, but the command giving an error, see below.

$ find . -mindepth 1 -maxdepth 1 -type d | xargs du -s * | sort -rn | awk '{system("ls -ld  "  $2)  ; exit}'

du: cannot access './VirtualBox': No such file or directory
du: cannot access 'VMs': No such file or directory
drwxr-xr-x 17 tecmint tecmint 184320 Nov 16 14:52 Downloads

Could you run the above command in your Linux setup, and share the output?

]]>
By: Gilles PION https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/comment-page-1/#comment-1915225 Wed, 16 Nov 2022 08:13:48 +0000 http://www.tecmint.com/?p=18279#comment-1915225 In reply to Ravi Saive.

Sorry for the two mistakes.

First, if running as root, wildcard ("*") expansion includes “dot directories“, and current dir (".") would always be the biggest one since it includes all others.

And there was also a mistake in the awk statement.

So this should do the trick:

$ find . -mindepth 1 -maxdepth 1 -type d | xargs du -s * | sort -rn | awk ‘{system(“ls -ld ” $2) ; exit}’

]]>
By: Ravi Saive https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/comment-page-1/#comment-1915210 Wed, 16 Nov 2022 07:48:31 +0000 http://www.tecmint.com/?p=18279#comment-1915210 In reply to Gilles PION.

@Gilles,

Thanks for the tip, but it didn’t work on my end. Here is the output of the command…

$ du -s * | sort -rn | awk '{system("ls  -ld $2") ; exit}'

drwxr-xr-x 33 tecmint tecmint 4096 Nov 16 10:46 .
]]>