<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[[实践OK]linux 下用ls怎样只列出目录，并对该目录赋予755的权限，ls 常用操作等，ls命令只显示目录或文件(linux)  。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Unix/LinuxC技术]]></category>
<pubDate>Fri, 02 Apr 2010 02:16:54 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	只显示目录：<br/>ls -l &#124; grep &#039;^d&#039;<br/>drwxr-xr-x&nbsp;&nbsp;2 root&nbsp;&nbsp;www&nbsp;&nbsp;512 12月&nbsp;&nbsp;6 15:18 aaa<br/><br/><textarea name="code" class="php" rows="15" cols="100">
 ls -l &#124; egrep &#039;^d&#039;
ls -l &#124; egrep &#039;^d&#039;&#124;wc -l
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25
</textarea><br/><br/>只显示文件：<br/><textarea name="code" class="php" rows="15" cols="100">
ls -l &#124; egrep -v &#039;^d&#039;
</textarea><br/><br/><br/>由于ls没有提供只显示目录的命令，所以我们只要搭配grep命令来显示目录<br/>0、在alpine和centos的Docker里实践只列出文件的兼容脚本如下：<br/>&nbsp;&nbsp;&nbsp;&nbsp; ls -al&#124;grep &quot;^-&quot;&#124;awk &#039;&#123;print $9&#125;&#039;<br/><br/>1、显示目录（不包含.及..），当然也可以包含，使用命令：ls -Fa &#124;grep &quot;/$&quot;<br/><textarea name="code" class="php" rows="15" cols="100">ls -F &#124;grep &quot;/$&quot;</textarea><br/><br/>2、显示当前目录的所有目录<br/><textarea name="code" class="php" rows="15" cols="100">ls -la &#124;grep &quot;^d&quot;</textarea><br/><br/>3、ls怎样只列出目录，并对该目录赋予755：<br/><div class="code">ls -l &#124; grep -e &quot;^d&quot; &#124;awk &#039;&#123;print $NF&#125;&#039;&#124;awk &#039;&#123;print &quot;chmod 755 &quot; $1 &quot;; chmod 644 &quot; $1 &quot;/* ;&quot;&#125;&#039;</div><br/><br/>http://www.whedu.net/cms/data/html/doc/2002-09/30/24866/index.html<br/>==================================================================<br/>ls 常用操作等:<br/>ls是list的简写，就是列出当前目录内容的意思。类似于DOS下的dir命令。用法：<br/>ls[选项][目录或文件]<br/>find命令是查找的意思查找；当你知道是哪个文件，然后可以用ls查找子文件；但是当不知道是什么盘符，哪个文件夹时就可以使用find命令查找。<br/>用法：find / -name httpd.conf，下面为一些其他用法，<br/>find / -amin -10 # 查找在系统中最后10分钟访问的文件<br/>find / -atime -2 # 查找在系统中最后48小时访问的文件<br/>find / -empty # 查找在系统中为空的文件或者文件夹<br/>find / -group cat # 查找在系统中属于 groupcat的文件<br/>find / -mmin -5 # 查找在系统中最后5分钟里修改过的文件<br/>find / -mtime -1 #查找在系统中最后24小时里修改过的文件<br/>find / -nouser #查找在系统中属于作废用户的文件<br/>find / -user fred #查找在系统中属于FRED这个用户的文件 <br/><br/>ls命令只显示目录或文件(linux)&nbsp;&nbsp;：<br/>网上找的并自己试验过。将各种命令集合起来，省得以后乱找。<br/><br/>只显示目录<br/>ls -F &#124; grep /$&nbsp;&nbsp;&nbsp;&nbsp;# -F使得ls将文件分类，通过在文件后面加一些标记来实现<br/>ls -F &#124; grep /<br/>ls -l &#124; grep ^d<br/>ls -d */<br/>ls -ld */<br/><br/>只显示文件<br/>ls -F &#124; grep [^&#92;/]$&nbsp;&nbsp;# 注意行尾匹配符号$不可少<br/>ls -F &#124; grep [^/]$<br/>ls -l &#124; grep ^-<br/>ls -l &#124; grep ^- &#124; wc -l&nbsp;&nbsp;# wc命令统计行数<br/>find . -type f -maxdepth 1 &#124; xargs ls -al<br/>ls -p &#124; grep [^/]$&nbsp;&nbsp;# -p使得ls命令在目录后面加斜杠<br/>find . ! -name . -prune -type f&nbsp;&nbsp; # 这个命令不会很好排序文件<br/><br/>摘处：http://blog.163.com/ytyang__/blog/static/8405845201112502159277/<br/><br/><br/>由于ls没有提供只显示目录的命令，所以我们只要搭配grep命令来显示目录<br/>1、ls -F &#124;grep &quot;/$&quot;<br/>显示目录（不包含.及..），当然也可以包含，使用命令：ls -Fa &#124;grep &quot;/$&quot;<br/>2、ls -la &#124;grep &quot;^d&quot;<br/>显示当前目录的所有目录<br/><br/>这两条命令原理一样；显示方式略有不同罢了；<br/><br/>摘自：http://www.linuxdiyf.com/viewarticle.php?id=179841
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践OK]linux 下用ls怎样只列出目录，并对该目录赋予755的权限，ls 常用操作等，ls命令只显示目录或文件(linux)  。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>