码迷,mamicode.com
首页 > 系统相关 > 详细

linux 中find 命令

时间:2014-10-22 21:52:35      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   sp   文件   div   log   bs   linux   

查找文件名称为test的文件并输入文件存在的路径

/ 为绝对路径  .为相对路径

 find / -name test -print

带测试的find命令

1 find . -newer test -print


在当前目录下查找比test 文件新的文件

联合查找,在当前目录下查找以下划线开头的文件或者是比test文件新的文件

1 find . \( -name "_" -or -newer test \) -type f -print

 

带命令的查找文件

1 find . newer test -type f -exec ls -l {}  \;

在文件中查找字符串(在ls.txt文件中查找really)

1 grep really ls.txt

在两个文件中计算匹配行的数目

1 grep -c really ls.txt lsl.txt

在两个文件中计算不匹配行的数目

1 grep -c -v really ls.txt lsl.txt

here文档

1 #!/bin/sh
2 cat <<!A.xsk!
3 hello
4 my name is A.xsk
5 document
6 !A.xsk!

 

linux 中find 命令

标签:style   blog   color   sp   文件   div   log   bs   linux   

原文地址:http://www.cnblogs.com/newworldcom/p/4044043.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!