<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Df Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/df/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/df/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:29:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Convert df -h output to html table</title>
		<link>https://www.scmgalaxy.com/tutorials/convert-df-h-output-to-html-table/</link>
					<comments>https://www.scmgalaxy.com/tutorials/convert-df-h-output-to-html-table/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 10:40:37 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Df]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2442</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: convert df -h output to html table Code shared on permonks by choroba. #!/usr/bin/perl use warnings; [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/convert-df-h-output-to-html-table/">Convert df -h output to html table</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: convert df -h output to html table</strong></p>
<p>Code shared on permonks by choroba.</p>
<p><code>#!/usr/bin/perl<br />
use warnings;<br />
use strict;</p>
<p>use Text::Table;<br />
use constant CAPACITY => 3;</p>
<p>my @lines = `df -hP`;<br />
my $header = shift @lines;<br />
# Do not create two columns for "Mounted" and "On"<br />
$header =~ s/Mounted /Mounted_/;<br />
my $table = Text::Table->new(split ' ', $header);<br />
{<br />
    no warnings 'numeric'; # Ignore % signs<br />
    @lines = sort { $a->[CAPACITY] <=> $b->[CAPACITY] }<br />
             map [split ' ', $_], @lines;<br />
}<br />
$table->load(@lines);<br />
print $table;</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @<a href="http://twitter.com/RajeshKumarIn"> twitter.com/RajeshKumarIn</a></p>
<p><strong>rajeshkumar replied the topic: Re: convert df -h output to html table</strong></p>
<p>There is one i made it working as below;</p>
<p><code>#############################################<br />
    #!/usr/local/bin/perl</p>
<p>    # Use either -h or -k flag or leave it blank for default (-k)<br />
    # -h for human-readable size output<br />
    # -k for 1k-block output<br />
    $flag = "-h";<br />
    @df = `df $flag`;</p>
<p>    print "Content-type: text/htmln\n";<br />
    print "</p>
<table border=2>\n";<br />
    print "</p>
<tr>\n";</p>
<p>    print "</p>
<td><b>Filesystem</b></td>
<p>\n";</p>
<p>    if ($flag eq "-h") {<br />
        print "</p>
<td><b>Size</b></td>
<p>\n";<br />
    }<br />
    else {<br />
        print "</p>
<td><b>1k-blocks</b></td>
<p>\n";<br />
    }</p>
<p>    print "</p>
<td><b>Used</b></td>
<p>\n";<br />
    print "</p>
<td><b>Avail</b></td>
<p>\n";<br />
    print "</p>
<td><b>Capacity</b></td>
<p>\n";<br />
    print "</p>
<td><b>Mounted on</b></td>
<p>\n";<br />
    print "</tr>
<p>\n";</p>
<p>    foreach $line (@df) {<br />
        next if ($line =~ /Filesystem/);</p>
<p>        ($fsystem,$blocks,$used,$avail,$capacity,$mounted) = split(/\s+/,$line);</p>
<p>        print "fsystem is $fsystem\n";<br />
        print "blocks is $blocks\n";<br />
        print "used is $used\n";<br />
        print "avail is $avail\n";<br />
        print "capacity is $capacity\n";<br />
        print "mounted is $mounted\n";</p>
<p>    ($number,$sign) = split(/%/,$capacity);<br />
    if ($number < 60) {
        print "

<tr bgcolor=green>\n";<br />
    }<br />
    elsif (($number >= 60) && ($number < 90)) {
        print "

<tr bgcolor=yellow>\n";<br />
    }<br />
    else {<br />
        print "</p>
<tr bgcolor=red>\n";<br />
    }<br />
    #<br />
    print "</p>
<td>$fsystem</td>
<p>\n";<br />
    print "</p>
<td>$blocks</td>
<p>\n";<br />
    print "</p>
<td>$used</td>
<p>\n";<br />
    print "</p>
<td>$avail</td>
<p>\n";<br />
    print "</p>
<td>$capacity</td>
<p>\n";<br />
    print "</p>
<td>$mounted</td>
<p>\n";<br />
    print "</tr>
<p>\n";<br />
    }</p>
<p>    print "</table>
<p>\n";</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/convert-df-h-output-to-html-table/">Convert df -h output to html table</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/convert-df-h-output-to-html-table/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Df and Du issues with script</title>
		<link>https://www.scmgalaxy.com/tutorials/df-and-du-issues-with-script/</link>
					<comments>https://www.scmgalaxy.com/tutorials/df-and-du-issues-with-script/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 07:26:42 +0000</pubDate>
				<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[Df]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2325</guid>

					<description><![CDATA[<p>scmuser created the topic: df and du issues with script A script named test containing the df and du commands [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/df-and-du-issues-with-script/">Df and Du issues with script</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: df and du issues with script</strong><br />
A script named test containing the df and du commands displays nothing when executed. Why does that happen? state two ways of making the script behave properly.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/df-and-du-issues-with-script/">Df and Du issues with script</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/df-and-du-issues-with-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Df command usage</title>
		<link>https://www.scmgalaxy.com/tutorials/df-command-usage/</link>
					<comments>https://www.scmgalaxy.com/tutorials/df-command-usage/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 04:45:49 +0000</pubDate>
				<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[Df]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2205</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: df command usage Filesystems using more than 90% capacity df -hP &#124; awk '{x=$5;sub ("%","",x)}x>75' df [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/df-command-usage/">Df command usage</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: df command usage</strong><br />
Filesystems using more than 90% capacity</p>
<p><code>df -hP | awk '{x=$5;sub ("%","",x)}x>75'<br />
df -h | awk '{if(NF==1){x=$0;getline;if(int($4)>90)print x,$0}else if(int($5)>90) print}'</code></p>
<p><code>ssh -q rajesh 'df -hP' | awk '{x=$5;sub ("%","",x)}x> 30'<br />
ssh -q rajesh 'df -h' | awk '{if(NF==1){x=$0;getline;if(int($4)>60)print x,$0}else if(int($5)>60) print}'</code></p>
<p><code>Error:<br />
df: unknown option: P<br />
Usage: df [-F FSType] [-abeghklntVvZ] [-o FSType-specific_options] [directory | block_device | resource]</code></p>
<p>Solution:</p>
<p>May be your solaris version is not supporting P options. Check it out without using -P.</p>
<p>df output filter based on Mounted on and Capacity</p>
<p><code>df -kh | awk '/\/export/ && int($5) >= 90'</code></p>
<p>Here Capacity &#8211; 90%<br />
Mounted on &#8211; \export<br />
df -kh | \ # Pipe the output of df to awk<br />
awk &#8216; # Start the awk script<br />
/\/mnt/ \ # Grep for pattern(first condition)<br />
&#038;&#038; \ # add a second condition (and)<br />
int($5) >= 85 \ # Check if integer of $5 is greater that 85(second condition)<br />
&#8216; # End awk script</p>
<p>Df Output to one line</p>
<p><code>ssh -q $server 'df -hP | cat' 2>&1</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/df-command-usage/">Df command usage</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/df-command-usage/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
