Walt Mankowski via plug on 20 Dec 2021 10:54:14 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Running out of disk space?


And I didn't know about the -h switch to sort! I usually run

du -b | sort -n

which gives the size in bytes and sorts numerically. But I can see

du -h | sort -h

being useful too.

On Mon, Dec 20, 2021 at 01:19:22PM -0500, Lynn Bradshaw via plug wrote:
> I had no idea about the "-s" switch for "du" before, or the exact pipe
> to "sort", so that's hugely useful new info, and I appreciate it. Does
> it work with "-c" as well?
> 
> Nevertheless, there is a caveat: the wildcard "*" will omit "hidden"
> files, at least in zsh or fish but probably also bash or whatever else
> one likes to use. I missed things from using that asterisk character.
> The period "." wildcard made more certain to cover everything.
> 
> Best,
> Lynn Bradshaw
> 
> On Mon, Dec 20, 2021 at 12:52 PM Rich Freeman <r-plug@thefreemanclan.net> wrote:
> >
> > On Mon, Dec 20, 2021 at 12:30 PM Lynn Bradshaw via plug
> > <plug@lists.phillylinux.org> wrote:
> > >
> > > * Use "du" with appropriate flags and current directories and show us the output
> >
> > Along those lines, two approaches I've found useful.
> >
> > First, if you're just trying to get a sense of where all your space is
> > going and are running X then try kdirstat or baobab, and I'm sure
> > there are alternatives.  This gives you more of a visual sense of how
> > all the space is used.  It takes a long time to do the scan, but then
> > you can navigate through it quickly as well.  (If you're on windows
> > windirstat is very useful for doing the same.)
> >
> > When I'm on the command line or have a sense of where I'm looking for
> > space use I use du.  A very useful way to go about this is to go into
> > a directory you want to explore and run:
> > du -sh * | sort -h
> >
> > That gives you a breakdown of how much space each subdirectory in the
> > current directory contains.  It of course still takes a while to scan
> > if those directories are large.  Instead of using * you can just list
> > directories of interest.  This is useful if you're in the root and
> > want to avoid looking in /usr or /lib or other places where you
> > wouldn't want to directly manage space use, and those directories have
> > lots of small files that slow things down.  The one exception I'd make
> > to that is that you should keep an eye on /lib/modules depending on
> > how your kernels are managed - you can accumulate a lot of old modules
> > if you don't clean out old kernels.  Distros vary on how that is
> > managed, or if it is managed at all.
> >
> > Places to keep an eye on are /var and /etc, and of course /home.  If
> > you have temp directories not managed by a tmp cleaning solution those
> > are obviously also worth looking at, though tmpfs usually ends up
> > taking care of that if you use it.
> >
> > --
> > Rich
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

Attachment: signature.asc
Description: PGP signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug