<?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>IPCPU——网络之路 &#187; find</title>
	<atom:link href="http://www.ipcpu.com/tag/find/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ipcpu.com</link>
	<description></description>
	<lastBuildDate>Sat, 03 Dec 2011 17:16:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>关于find中的atime、ctime、mtime的区别</title>
		<link>http://www.ipcpu.com/2010/07/linux-find-atime-ctime/</link>
		<comments>http://www.ipcpu.com/2010/07/linux-find-atime-ctime/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 11:04:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[命令]]></category>

		<guid isPermaLink="false">http://www.ipcpu.com/?p=673</guid>
		<description><![CDATA[这几天碰到的一个面试题。 find用法：     -atime n               File was last accessed n*24 hours ago.  访问（读取文件或执行文件）         -ctime n               File’s status was last changed n*24 hours ago.  写入修改 更改属主  -mtime n               File’s  data was last modified n*24 hours ago.  写入修改    -amin n               File was last accessed n minutes ago.这是按分钟来算的一般不用  -cmin n               File’s [...]]]></description>
			<content:encoded><![CDATA[<p>这几天碰到的一个面试题。</p>
<p>find用法：<br />
 <br />
  -atime n<br />
              File was last accessed n*24 hours ago.  访问（读取文件或执行文件）<br />
      <br />
 -ctime n<br />
              File’s status was last changed n*24 hours ago.  写入修改 更改属主</p>
<p> -mtime n<br />
              File’s  data was last modified n*24 hours ago.  写入修改<br />
 <br />
 -amin n<br />
              File was last accessed n minutes ago.这是按分钟来算的一般不用<br />
 -cmin n<br />
              File’s status was last changed n minutes ago.</p>
<p>关于+n还是-n</p>
<p>        +n     for greater than n,  #N天以外的，N天前的</p>
<p>        -n     for less than n,     #N天以内的</p>
<p>        n      for exactly n.     #正好的</p>
<p>例子：<br />
-bash-3.2$ ll<br />
total 24<br />
-rw-r&#8211;r&#8211; 1 wss8848 member    6 2010-07-13 20:58 1.txt<br />
-rw-r&#8211;r&#8211; 1 wss8848 member   63 2010-07-11 21:08 awk.txt<br />
-rwxr&#8211;r&#8211; 1 wss8848 member  160 2010-<span style="color: #ff0000;">07-04</span> 00:00 if.sh<br />
-bash-3.2$ <span style="color: #ff0000;">find -atime +8</span><br />
<span style="color: #ff0000;">./if.sh</span><br />
-bash-3.2$ date<br />
Tue <span style="color: #ff0000;">Jul 13</span> 21:31:04 CST 2010<br />
-bash-3.2$</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipcpu.com/2010/07/linux-find-atime-ctime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux学习笔记之find命令</title>
		<link>http://www.ipcpu.com/2010/06/linux-find-command/</link>
		<comments>http://www.ipcpu.com/2010/06/linux-find-command/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 15:17:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.ipcpu.com/?p=655</guid>
		<description><![CDATA[1.如果想在当前目录查找文件名以两个小写字母开头，跟着是两个数字，最后是*.txt的文件，下面的命令就能够返回名为ax37.txt的文件：   $ find . -name  &#8220;[a-z][a-z][0--9][0--9].txt&#8221; -print 2.想要在当前目录及子目录中查找所有的‘*.txt’文件，可以用：   $ find . -name  &#8220;*.txt&#8221; -print 3.想要查找txt后缀，并且权限644的文件   $ find ~ -name &#8220;*.txt&#8221; -perm 644 -print 4.在$HOME目录中查找文件属主为dave的文件，可以用：   $ find ~ -user  dave -print 5.希望在系统根目录下查找更改时间在5日以内的文件，可以用：   $ find/-mtime -5 -print   6.为了在/var/adm目录下查找更改时间在3日以前的文件，可以用：   $ find /var/adm  -mtime +3 -print   【4、5是碰到的面试题，可惜那时不懂】 7.如果要在/etc目录下查找所有的目录，可以用：   $find /etc -type  [...]]]></description>
			<content:encoded><![CDATA[<p>1.如果想在当前目录查找文件名以两个小写字母开头，跟着是两个数字，最后是*.txt的文件，下面的命令就能够返回名为ax37.txt的文件：<br />
  $ find . -name  &#8220;[a-z][a-z][0--9][0--9].txt&#8221; -print</p>
<p>2.想要在当前目录及子目录中查找所有的‘*.txt’文件，可以用：<br />
  $ find . -name  &#8220;*.txt&#8221; -print</p>
<p>3.想要查找txt后缀，并且权限644的文件<br />
  $ find ~ -name &#8220;*.txt&#8221; -perm 644 -print</p>
<p>4.在$HOME目录中查找文件属主为dave的文件，可以用：<br />
  $ find ~ -user  dave -print</p>
<p>5.希望在系统根目录下查找更改时间在5日以内的文件，可以用：<br />
  $ find/-mtime -5 -print<br />
 <br />
6.为了在/var/adm目录下查找更改时间在3日以前的文件，可以用：<br />
  $ find /var/adm  -mtime +3 -print   【4、5是碰到的面试题，可惜那时不懂】</p>
<p>7.如果要在/etc目录下查找所有的目录，可以用：<br />
  $find /etc -type  d -print<br />
 <br />
8.为了在当前目录下查找除目录以外的所有类型的文件，可以用：<br />
  $find . ! -type  d -print</p>
<p>9.为了在当前目录下查找文件长度大于1M字节的文件，可以用：<br />
  $find . -size  +1000000c -print<br />
 <br />
10.为了在/home/apache目录下查找文件长度恰好为100字节的文件，可以用：<br />
  $find /home /apache  -size 100c -print</p>
<p>11. 下面的例子在/apps/audit目录下查找所有用户具有读、写和执行权限的文件，并收回相应的写权限：<br />
  $ find /apps/audit  -perm -7 -print | xargs chmod o -w</p>
<p>find命令是一个非常优秀的工具，它可以按照用户指定的准则来匹配文件。使用exec和xargs可以使用户对所匹配到的文件执行几乎所有的命令。</p>
<p>=======================<br />
修改文件时间戳<br />
touch -t 201007042254 we.txt<br />
touch -d 20100704 you.txt</p>
<p>======================</p>
<p>find 学习笔记 enhenced 2</p>
<p>查找文件并对查找的文件执行命令</p>
<p><span style="color: #ff0000;"><strong>Command must end with Space\;命令必须以空格加\;结束</strong></span></p>
<p>find -name &#8220;*.conf&#8221; -exec cp {} {}.orig \;</p>
<p>查找.conf结尾的文件，并以文件名.orgi进行备份</p>
<p>find /tmp -ctime +3 -user joe -ok rm {} \;</p>
<p>删除tmp中用户joe三天前的文件</p>
<p>find ~ -perm +o+w -exec chmod o-w {} \;</p>
<p>去掉可写文件写权限</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipcpu.com/2010/06/linux-find-command/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

