fhg
Volume 6, Number 41 -- November 8, 2006

Finding Large IFS Directories

Published: November 8, 2006

Hey, Ted:

The Integrated File System (IFS) continues to grow in importance in our shop. That means it also continues to grow in size. How can we determine which directories are largest when it comes time to clean them up?

--Dan


Use the Start Qshell (STRQSH or QSH) command to open Qshell. Use cd to navigate to any directory, then try this command.

ls -alsF | grep /$ | sort -r

Clear as mud, huh? Let's look at it in detail. The ls command lists the files in a directory. In this case, the directory to be listed is the current directory. The following table explains the function of the four switches.


Switch

Description

-a

Include directory entries whose names begin with a period.

-l (ell)

Display each entry in long format.

-s

Display size in units of 1024 bytes.

-F

Append / to directory names, * to executables, and @ to symbolic links.


Therefore, the ls command lists the directories directly under the current directory. Each directory name is followed by a slash. Since the file/directory name is the last column in the report, this slash will be the last character on the lines that list a directory name. The first column of each line is the file size in 1K blocks.

Grep looks for lines that end with a slash and passes them along to the sort routine. The dollar sign ($) tells grep that the pattern--in this case, a slash--must match the end of the line. Grep extracts directories only.


Parameter

Description

/$

Look for a slash at the end of the line.


Finally the sort utility sorts the list of directories in descending order by the first column, the file size in 1K blocks.


Switch

Description

-r

Sort in descending order (reverse).


The result looks something like this:

 1588 drwxrwsrwx  453 QSYS   0      1626112 Nov  2 10:21 ../         
  264 drwxrws---   10 BR549  0       270336 May  3  2006 ./          
   88 drwxrws---    4 JSMITH 0        90112 Oct 21  2006 ftp/        
   80 drwxrwsrwx    3 JSMITH 0        81920 May 25  2005 temp/       
   80 drwxrwsrwx    2 JSMITH 0        81920 Sep 18  2005 backup/     
   80 drwxrwsrwx    2 JSMITH 0        81920 Mar 18  2006 shelld/
   80 drwxrws---    2 JSMITH 0        81920 Oct 21  2006 shellb/ 
   80 drwxrws---    2 BR549  0        81920 Aug  3  2001 NETDATA/    
   72 drwxrwsrwx    2 JSMITH 0        73728 Nov 16  2002 bin/        
   72 drwxrws---    2 BR549  0        73728 Aug  3  2001 WWW/       

When it comes to working with the IFS, I find Qshell to be as handy as a pocket!

--Ted



Sponsored By
SEQUEL

SEQUEL can be used for virtually ALL
data access functions on the System i, including:

                                                · Executive Dashboards
                                                · Graphical Query & Reporting
                                                · Drill-Down Data Analysis
                                                · Multi-Platform Database Support
                                                · E-Mail Report and File Distribution
                                                · Secure Web Access

SEQUEL is the ONE solution for all your data access needs.

www.helpsystems.com



Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

Bytware:  StandGuard Network Security 3.0, the next generation of System i security
T.L. Ashford:  BARCODE400 - the fastest way to create compliance labels directly from the iSeries
COMMON:  Join us at the Spring 2007 conference, April 29 – May 3, in Anaheim, California

 


 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement