<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[如何查找Linux下的大目录]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[服务器技术]]></category>
<pubDate>Fri, 13 Nov 2015 21:33:15 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	譬如有时候磁盘空间告警了，而你平时又疏于管理、监控文件的增长，那么我需要快速的了解哪些目录变得比较大，那么此时我们可以借助du命令来帮我们解决这个问题。<br/><div class="code"><br/>&#91;root@getlnx01 u03&#93;# du -h --max-depth=1<br/>16K&nbsp;&nbsp;&nbsp;&nbsp; ./lost+found<br/>33G&nbsp;&nbsp;&nbsp;&nbsp; ./flash_recovery_area<br/>37G&nbsp;&nbsp;&nbsp;&nbsp; ./oradata<br/>70G&nbsp;&nbsp;&nbsp;&nbsp; .<br/></div><br/>如果你想知道flash_recovery_area目录下面有哪些大文件夹，那么可以将参数max-depth=2 ，如果你想对搜索出来的结果进行排序，那么可以借助于sort命令。如下所示<br/><div class="code"><br/>&#91;root@getlnx01 u03&#93;# du -h --max-depth=2 &#124; sort -n<br/>3.5G&nbsp;&nbsp;&nbsp;&nbsp;./flash_recovery_area/EPPS<br/>16K&nbsp;&nbsp;&nbsp;&nbsp; ./lost+found<br/>29G&nbsp;&nbsp;&nbsp;&nbsp; ./flash_recovery_area/backup<br/>33G&nbsp;&nbsp;&nbsp;&nbsp; ./flash_recovery_area<br/>37G&nbsp;&nbsp;&nbsp;&nbsp; ./oradata<br/>37G&nbsp;&nbsp;&nbsp;&nbsp; ./oradata/epps<br/>70G&nbsp;&nbsp;&nbsp;&nbsp; .<br/>&#91;root@getlnx01 u03&#93;# du -hm --max-depth=2 &#124; sort -n<br/>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ./lost+found<br/>3527&nbsp;&nbsp;&nbsp;&nbsp;./flash_recovery_area/EPPS<br/>29544&nbsp;&nbsp; ./flash_recovery_area/backup<br/>33070&nbsp;&nbsp; ./flash_recovery_area<br/>37705&nbsp;&nbsp; ./oradata<br/>37705&nbsp;&nbsp; ./oradata/epps<br/>70775&nbsp;&nbsp; .<br/></div><br/><div class="code"><br/>&#91;root@getlnx01 u03&#93;# cd /<br/><br/>&#91;root@getlnx01 /&#93;# du -hm --max-depth=2 &#124; sort -n<br/></div><br/>有时候搜索出来的结果太多了（譬如，我从根目录开始搜索），一直在刷屏，如果我只想查出最大的12个文件夹，怎么办呢？此时就要借助head命令来显示了<br/><br/><div class="code"><br/>&#91;root@getlnx01 /&#93;# du -hm --max-depth=2 &#124; sort -nr &#124; head -12<br/>407480&nbsp;&nbsp;.<br/>167880&nbsp;&nbsp;./u04<br/>158685&nbsp;&nbsp;./u02/oradata<br/>158685&nbsp;&nbsp;./u02<br/>152118&nbsp;&nbsp;./u04/oradata<br/>70775&nbsp;&nbsp; ./u03<br/>37705&nbsp;&nbsp; ./u03/oradata<br/>33070&nbsp;&nbsp; ./u03/flash_recovery_area<br/>5995&nbsp;&nbsp;&nbsp;&nbsp;./u01/app<br/>5995&nbsp;&nbsp;&nbsp;&nbsp;./u01<br/>3551&nbsp;&nbsp;&nbsp;&nbsp;./usr<br/>1558&nbsp;&nbsp;&nbsp;&nbsp;./usr/share<br/>&#91;root@getlnx01 /&#93;# <br/></div><br/>Tags - <a href="http://www.dzhope.com/tags/linux/" rel="tag">linux</a> , <a href="http://www.dzhope.com/tags/%25E6%259F%25A5%25E6%2589%25BE/" rel="tag">查找</a> , <a href="http://www.dzhope.com/tags/find/" rel="tag">find</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] 如何查找Linux下的大目录]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>