[K12OSN] OT: user's disk usage and inodes

Jeff Kinz jkinz at kinz.org
Mon Jan 31 14:37:23 UTC 2005

On Mon, Jan 31, 2005 at 08:41:56AM -0500, aust_txv at ACCESS-K12.org wrote:
> >> du -s /home/* | sort -n | less
> >>ls -asRS /home/badstudent |less
> Thanks, good stuff !!!!  a command line xdiskusage - - very sweet.  This 
> helps sooo much, I can remote admin these file systems.  Will do.  This 
> looks like it could take a while.  That is a new approach for me.

Hi Tom.  I realize you didn't intend it but I got a chuckle out of
your reaction (above).

Why? because xdiskusage runs "du" and presents the info in a GUI

UNIX/Linux is primarily text-based environment. Many of the text
based commands existed before any graphical user environments were 
even being considered.  This is where the power of UNIX seems to come

The GUI stuff (called X-Windows) was created by a consortium of
companies and Universities to try to create an Industry wide,
all-platforms-compatible standard for a graphical environment. (You can
even run X-windows on VMS or an Amiga!)

Here is the key point:
Almost everything you do as an admin on UNIX ends up being a text 
based operation.  Given the shell scripting and other utility languages
available in UNIX you have much more power and usually more speed 
by using the command line interface.

> I use the following command now to find files
> Note: All my student and teacher ID's start with a prefix
> # find /home/userprefix* -name '*.zip* -ok rm '{}' ';'
> change *.zip to *.mp3 or whatever... *.exe  aol*.*  then you can delete 
> them.
> change -ok to -exec and you won't get prompted for a delete response y/n.

Also consider the use of the "file" command which examines the file and
tells you what it is.  This is a way to more accurately identify files.

(What if your users start changing their mp3 files to end in ".text"?
They may start doing that once their collections start disapearing..)

Simplistically, like:
find /home/userprefix* -exe file '{}' ';'  | grep -i mp3 > /tmp/mp3list

or use a fancier compound egrep to grab all the file types you want in a
single line:

egrep "mp3|mpg|exe" 

These are simplistic examples.  The real world may require more care in 
the crafting of your regular expressions.

Linux/Open Source:  Your infrastructure belongs to you, free, forever.
Idealism:  "Realism applied over a longer time period"
http://www.fedoratracker.org http://www.fedorafaq.org
Jeff Kinz, Emergent Research, Hudson, MA.

More information about the K12OSN mailing list