文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>linux下查找实用技巧

linux下查找实用技巧

时间:2010-09-06  来源:mrchenlang

linux下文件很多,有时候找起来很麻烦,下面介绍两条非常使用的查找技巧: 1.查找文件 find 例: find /etc  -name profile   //查找 /etc下名为 profile 的文件

chen@chen:~$ find /etc -name profile
find: `/etc/ppp/peers': Permission denied
/etc/profile
find: `/etc/cups/ssl': Permission denied
find: `/etc/chatscripts': Permission denied
find: `/etc/ssl/private': Permission denied
/etc/firefox/profile


有的文件可能存在权限问题!
  利用通配符查找 查找 /etc 下包含 profile的文件名

chen@chen:~$ find ./test/ -name "*led*"
./test/mmu/leds.o
./test/mmu/leds.c

    查找字符 例: grep -rnH "printf"  /home/chen/test/   //在 /home/chen/test 下递归查找包含"printf"的字符  

chen@chen:~$ grep -rnH printf ./test/
./test/hello.c:6: printf("hello!\n");
./test/macro.c:10: printf("The file is %s\n",__FILE__);
./test/macro.c:11: printf("The file is %d\n",__LINE__);
./test/macro.c:12: printf("The file is %s\n",__FUNCTION__);
./test/macro.c:14: printf("The file is %s\n",__DATE__);
./test/macro.c:15: printf("The file is %s\n",__TIME__);
./test/macro.c:16: printf("%s""%s""\n",__FILE__,__TIME__);
./test/max.c:7: printf("%d\n",MAX(3,4));
./test/make/chenlang.c:5: printf("Hello! I am chenlang!\n");
./test/stuct_test.c:15: printf("%d\n",sizeof(struct A));
./test/heap.c:8: printf("%x\n",&p);
./test/heap.c:9: printf("%x\n",&p+1);
./test/heap.c:10: printf("%x\n",&p+2);
./test/test.c:18: //printf("please input passwd!\n");
./test/test.c:24: printf("%s\n",passwd);
./test/test.c:25: printf("%s\n",ptr);*/
./test/test.c:39: printf("recv signal\n");




相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载