<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Finding files to trim in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953058#M98871</link>
    <description>for i in $(&lt;FILE&gt;&lt;/FILE&gt;do&lt;BR /&gt;find ${i} -exec ll -d {} \; | sort -nrk5&lt;BR /&gt;done</description>
    <pubDate>Wed, 18 Jan 2006 01:00:12 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2006-01-18T01:00:12Z</dc:date>
    <item>
      <title>Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953051#M98864</link>
      <description>Hey gang,&lt;BR /&gt;&lt;BR /&gt;/ on one of our systems is slowly growing.  I have a two part question to ask the group....&lt;BR /&gt;&lt;BR /&gt;1)  Does anyone have a script that will look in / and find and list the largest files in / excluding all other mounted volumes?  A script that would be portable or would require no editing as volumes are added/deleted would be preferred.&lt;BR /&gt;&lt;BR /&gt;2)  I was wondering if anyone had a script that would look for files to trim or delete on / or various other volumes (like /var or /opt).  Is there a list of files or filetypes to look for that would qualify for occasional purging?  This is for 11.11 systems.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help.</description>
      <pubDate>Tue, 17 Jan 2006 19:28:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953051#M98864</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2006-01-17T19:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953052#M98865</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;The following script will list (and sum) the size of all directories except mounted ones:&lt;BR /&gt;&lt;BR /&gt;# ls -il / | perl -nae 'if ($.&amp;gt;1 &amp;amp;&amp;amp; $F[0]!=2 &amp;amp;&amp;amp; $F[1]=~/^d/) {$v=`du -ks $F[9]`;print $v;@s=split(/\s+/,$v);$t+=$s[0]};END{print "$t\n"}'&lt;BR /&gt;&lt;BR /&gt;This code relies on the fact that a directory that is a mountpoint will *always* have an inode=2.  Remember, inode values are only unique within a filesystem.&lt;BR /&gt;&lt;BR /&gt;Another way to list directory sizes is :&lt;BR /&gt;&lt;BR /&gt;# du -xk /var|sort -k1nr|more&lt;BR /&gt;&lt;BR /&gt;...This will restrict 'du' to reporting directory size in the order largest-to-smallest beneath a mountpoint.  &lt;BR /&gt;&lt;BR /&gt;The idea of both the above is to identify directories which have significant space.&lt;BR /&gt;&lt;BR /&gt;As for looking for "large" files you could do something like:&lt;BR /&gt;&lt;BR /&gt;# find /pathname -xdev -type f -size +10000c -exec ls -l {} \; | sort -k5nr&lt;BR /&gt;&lt;BR /&gt;This would find all files in /pathname (without crossing mountpoints) whose size exceeds 10,000 characters.  The output would be a stnadard 'ls' file listing sorted from largest to smallest by size.&lt;BR /&gt;&lt;BR /&gt;As for trimming and/or deleting files in '/var/ and /'opt', the place to concentrate is '/var'.  '/opt' should be static.  See the manpages for 'hier(5)' for details.&lt;BR /&gt;&lt;BR /&gt;That being said, files in:&lt;BR /&gt;&lt;BR /&gt;/var/preserve --- are old 'vi' recovery files and if old can be deleted.&lt;BR /&gt;&lt;BR /&gt;/var/adm/sw --- do *NOT* manage this manually.  The *only* safe way to reclaim space is to use 'cleanup'.  To do otherwise you run the risk of corrupting your Installed Product Database and you will not be able to patch your server again!&lt;BR /&gt;&lt;BR /&gt;/var/adm/wtmp, /var/adm/btmp --- these are logs of successful and unsuccessful logins respectively.   Trim them to zero by redirecting '/dev/null' to them or trim them with 'fwtmp' by converting them to ASCII to edit them and reconverting them to binary after they have been trimmed.&lt;BR /&gt;&lt;BR /&gt;/var/adm/crash --- should only have unanalyzed crash dumps from high-priority machine checks.  If you find something here that's old you can delete it unless you want HP Suppport to analyze it.&lt;BR /&gt;&lt;BR /&gt;/var/adm/mail --- have your users cleanup their mail folders and this won't be a problem.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 17 Jan 2006 20:01:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953052#M98865</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-17T20:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953053#M98866</link>
      <description>Hey James,&lt;BR /&gt;&lt;BR /&gt;Wow...what a great response!!!  That deserves 20 points!!!&lt;BR /&gt;&lt;BR /&gt;I have another question along these lines...&lt;BR /&gt;&lt;BR /&gt;I have a file that contains a list of directories.  I want to get a sort these files by size so that the largest file is displayed first.  Something like this...&lt;BR /&gt;&lt;BR /&gt;find /{this is where I want to check the list of dirs in my file) -depth -type f -exec ll {} \; &amp;gt;&amp;gt; /tmp/file1 &lt;BR /&gt;&lt;BR /&gt;sort -r -n -k 5,5 /tmp/file1 &amp;gt; /tmp/file2&lt;BR /&gt;&lt;BR /&gt;How can I write this so that it will go through my file and do the find on each of the entries in the file so I can then do the sort?&lt;BR /&gt;&lt;BR /&gt;Thanks for the help.</description>
      <pubDate>Tue, 17 Jan 2006 22:30:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953053#M98866</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2006-01-17T22:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953054#M98867</link>
      <description>There are some simple commands that will do the work. You need to be careful about trimming the files. you should understnad what are those files and what processes might be accessing them.&lt;BR /&gt;&lt;BR /&gt;du -kx / | sort -n --&amp;gt; Will list dir sorted in ascending order&lt;BR /&gt;&lt;BR /&gt;Once you note the dir that are using most of the space, run du on them again to see what is holding the space.</description>
      <pubDate>Tue, 17 Jan 2006 22:36:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953054#M98867</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-01-17T22:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953055#M98868</link>
      <description>Is there way to get a sort of just the files?  Here is what I'm trying to do...&lt;BR /&gt;&lt;BR /&gt;I have a file...FILE1 that contains the following...&lt;BR /&gt;&lt;BR /&gt;entry1&lt;BR /&gt;entry2&lt;BR /&gt;entry3&lt;BR /&gt;&lt;BR /&gt;I want to run a find on the entries in the file so I can collect and sort the output.&lt;BR /&gt;&lt;BR /&gt;Also getting all the information that a ls -l gives would help tremendously.</description>
      <pubDate>Tue, 17 Jan 2006 23:16:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953055#M98868</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2006-01-17T23:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953056#M98869</link>
      <description># du -skx /usr/* | sort -nr | head -10&lt;BR /&gt;&lt;BR /&gt;(List the top 10 files) &lt;BR /&gt;&lt;BR /&gt;# ls -lR | sort +4 -5nr | more &lt;BR /&gt;&lt;BR /&gt;(List all files starting with biggest) &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Tue, 17 Jan 2006 23:23:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953056#M98869</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-01-17T23:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953057#M98870</link>
      <description>I REALLY REALLY need this to do the find on the entries in the file.  How can I do that?  Thanks.</description>
      <pubDate>Wed, 18 Jan 2006 00:49:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953057#M98870</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2006-01-18T00:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953058#M98871</link>
      <description>for i in $(&lt;FILE&gt;&lt;/FILE&gt;do&lt;BR /&gt;find ${i} -exec ll -d {} \; | sort -nrk5&lt;BR /&gt;done</description>
      <pubDate>Wed, 18 Jan 2006 01:00:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953058#M98871</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-01-18T01:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953059#M98872</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;#du -xk `cat /home/hp/file1` |sort -rnk1 |pg&lt;BR /&gt;&lt;BR /&gt;Where /home/hp/file1 is the file and you are executing the command at any location. The contents of the file are with absolute path like&lt;BR /&gt;&lt;BR /&gt;/var&lt;BR /&gt;/opt&lt;BR /&gt;/home&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Devender</description>
      <pubDate>Wed, 18 Jan 2006 01:04:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953059#M98872</guid>
      <dc:creator>Devender Khatana</dc:creator>
      <dc:date>2006-01-18T01:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953060#M98873</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Perhaps this is what you are seeking (based upon your last post, above):&lt;BR /&gt;&lt;BR /&gt;cat filelist.sh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;    find ${LINE} -xdev -type f | xargs ls -l&lt;BR /&gt;done &amp;lt; filelist | \&lt;BR /&gt;sort -k5nr&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;...The 'filelist' is a simple file with directories of interest listed one per line.  For example:&lt;BR /&gt;&lt;BR /&gt;# cat filelist&lt;BR /&gt;/etc&lt;BR /&gt;/sbin&lt;BR /&gt;/stand&lt;BR /&gt;&lt;BR /&gt;Note that you don't have to use any temporary files (only pipes) and that I have avoided the more expensive '-exec' with 'find' which would spawn a separate process for every 'ls' request.  The 'xargs' bundles multiple requests and greatly reduces subprocess initiation.  The 'find' traversing directories is brutal enough on any system!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 18 Jan 2006 07:46:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953060#M98873</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-18T07:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953061#M98874</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Apart from this I always use the SAM to trim the log files. This I think is the best way to this, as it also shows you the existing size of all files in one windows itself.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Devender</description>
      <pubDate>Wed, 18 Jan 2006 07:49:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953061#M98874</guid>
      <dc:creator>Devender Khatana</dc:creator>
      <dc:date>2006-01-18T07:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953062#M98875</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;if you go in SAM, you will get a few system logfiles that you can trim using the same interface. However, the list exclude maybe larger log files that could be generated by application programs.&lt;BR /&gt;&lt;BR /&gt;beware that there are some files that you cannot just delete! You must document yourself fully before doing so. E.g. Oracle Redolog files cannot be just deleted!!&lt;BR /&gt;&lt;BR /&gt;hope this helps too!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Wed, 18 Jan 2006 08:01:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953062#M98875</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2006-01-18T08:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953063#M98876</link>
      <description>It is very easy to add files to the list in SAM that can be monitored and trimmed.  HP can know which application files you have that may need to be monitored.</description>
      <pubDate>Wed, 18 Jan 2006 10:58:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953063#M98876</guid>
      <dc:creator>Ted Buis</dc:creator>
      <dc:date>2006-01-18T10:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953064#M98877</link>
      <description>Thank you all for the help!!!  I was able to get what I needed done!!!</description>
      <pubDate>Wed, 18 Jan 2006 18:31:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953064#M98877</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2006-01-18T18:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953065#M98878</link>
      <description>Hi,&lt;BR /&gt;cat your_file|xargs -i find . -name {} -exec ll {} \;&lt;BR /&gt;&lt;BR /&gt;this will find the files contained into your_file.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;ART</description>
      <pubDate>Thu, 19 Jan 2006 04:03:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953065#M98878</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-01-19T04:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files to trim</title>
      <link>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953066#M98879</link>
      <description>thanks</description>
      <pubDate>Thu, 05 Oct 2006 21:54:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/finding-files-to-trim/m-p/4953066#M98879</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2006-10-05T21:54:47Z</dc:date>
    </item>
  </channel>
</rss>

