Question & Answer
Question
How to find and list large files in IFS
Cause
This tip can be helpful when your system is running out of storage and you are trying to identify large files in IFS that could potentially be taking up room, like ISO image files etc.
Answer
Find based on size
You can use the "find" command to search a filesystem to find large files. I especially like the "-xdev" flag which tells find to not traverse in to directories that are not part of the filesystem you are searching on. This is especially useful when your "/" (root) filesystem fills up because if you do a "find" on "/" without -xdev it will search every filesystem on the system since they are mounted under "/". But with "-xdev" it will only search what is actually in the "/" filesystem and skip everything else.
These commands need to run in PASE shell.
You can launch PASE shell from OS/400 commandline by using CALL QP2TERM.
Find all files larger than 1 MB:
find /tmp -xdev -size +`echo 1024*1024 | bc`c -ls
Sample output:
44178 7954 -rwxrwxrwx 1 qbrms 0 8144071 Dec 3 10:19 /tmp/brms/flightrec
71392 276152 -rwxrwxrwx 1 qbrms 0 282779391 Dec 19 10:54 /tmp/brms/qbrms
4096 2689 -rwxrwxrwx 1 kentb 0 2752708 Feb 10 2014 /tmp/Lionel.pdf
Find all files larger than 40 MB:
find /tmp -xdev -size +`echo 1024*1024*40 | bc`c -ls
Find all files larger than 1 GB:
find /tmp -xdev -size +`echo 1024*1024*1024 | bc`c -ls
You can replace /tmp with the directory of your own interest i.e /home/* or /QIBM/UserData/* etc
Note that I'm just doing simple math with "bc" to calculate the byte size. For example, if you wanted 500 MB it would be 1024*1024*500. If you wanted 50 GB it would be 1024*1024*1024*50.
Was this topic helpful?
Document Information
Modified date:
18 December 2019
UID
nas8N1020470