From owner-freebsd-questions Thu Dec 9 5:44:44 1999 Delivered-To: freebsd-questions@freebsd.org Received: from hsalouserv1.hsacorp.net (208-247-171-50.hsacorp.net [208.247.171.50]) by hub.freebsd.org (Postfix) with ESMTP id E54E8150C9 for ; Thu, 9 Dec 1999 05:44:40 -0800 (PST) (envelope-from jconner@enterit.com) Received: from jimhomecomp (24-216-177-226.hsacorp.net [24.216.177.226]) by hsalouserv1.hsacorp.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id YM3V4H8Y; Thu, 9 Dec 1999 08:39:13 -0500 Message-Id: <4.2.0.58.19991208084058.009ac100@mail.enterit.com> X-Sender: jconner@mail.enterit.com X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Wed, 08 Dec 1999 08:44:50 -0500 To: FreeBSD Questions From: Jim Conner Subject: Re: hopefully three simple questions In-Reply-To: <19991208235053.A13173@kearneys.ca> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I sent these to Crist last night. The shell script doesn't work :) (what can I say...I threw it together in 20 minutes)....however, the find will at least give a count of files in each directory based on where you run the find command from and store the output to a file of your choice. I don't think you will be able to answer this guy's questions with simple command on the command line. Its going to require scripting (I think) find . -type d -exec wc -l {} \; >files.out #!/bin/ksh counter=0 var=0 file=files.out find . -type d -exec wc -l {} \; >$file for loop in `cat $file | grep -E [0-9] | awk '{print $1}'` do counter=$((counter + 1)) var[$counter]=$loop if [ $counter = 2 ] then if [ ${var[1]} -gt ${var[2]} ] then largest=${var[1]} counter=1 elif [ ${var[2]} -gt ${var[1]} ] then largest=${var[2]} counter=1 else counter=1 fi else blah=0 fi done echo "The largest directory had $largest files: `grep $largest $file`" rm $file At 11:50 PM 12/8/99 -0800, Brent Kearney wrote: >On Wed, Dec 08, 1999 at 11:19:01AM -0500, Zhihui Zhang wrote: > > > > I got three questions: > > > > (1) How to determine the deepest directory in a filesystem? > > > > (2) How to find the largest directory in a filesystem? I mean the one > > with the maximum number of files in it. > >I'm not sure off hand how to go about this, perhaps some shell-wizard >will answer your post. For those who don't get the question, I think >what it means is 1) How do you count how many subdirectories "deep" a >filesystem goes, i.e., /mnt/blah/blah1/blah2/blah3/blah4/blah5, for the >'blah' filesystem, there is a depth of 5., and 2) how do you count all >of the files in a filesystem and report which directory has the most >files in it? > >Zhihui, it is likely some combination of "find" and "du". > > > > > (3) How to enforce automatic logout after specified amount of time? > > > >This is set in /etc/login.conf, with the :idletime directive. See man >login.conf for details. > >-Brent > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Today's errors, in contrast: Windows - "Invalid page fault in module kernel32.dll at 0032:A16F2935" UNIX - "segmentation fault - core dumped" Humanous Beingsus - "OOPS, I've fallen and I can't get up" ------------------------------- Jim Conner NOTJames jconner@enterit.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message