浏览 2453 次
锁定老帖子 主题:如何在Linux下递归查看所有文件或目录?
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2015-04-15
find命令,是个非常nice的命令,如果你还不了解这个命令,可以使用man find命令,来查看具体的介绍,find命令结合grep命令之后是非常强大的: (1)找出某个目录下所有的文件,并且是csv结尾的: <pre name="code" class="java">[search@dnode1 2015-04-10]$ find ./conversions/ -type f | grep "csv$" ./conversions/pv/tmp_search_date_cate_pv/tmp_search_date_cate_pv.csv ./conversions/pv/tmp_search_date_algo_channel_pv/tmp_search_date_algo_channel_pv.csv ./conversions/pv/tmp_search_date_pv/tmp_search_date_pv.csv ./conversions/pv/tmp_search_date_algo_pv/tmp_search_date_algo_pv.csv ./conversions/pv/tmp_search_date_algo_country_pv/tmp_search_date_algo_country_pv.csv ./conversions/pv/tmp_search_date_algo_cate_pv/tmp_search_date_algo_cate_pv.csv [search@dnode1 2015-04-10]$ </pre> (2)同理找出以0结尾的文件: <pre name="code" class="java">[search@dnode1 2015-04-10]$ find ./conversions/ -type f | grep "0$" ./conversions/uv/tmp_search_date_algo_uv/000000_0 ./conversions/uv/tmp_search_date_algo_channel_uv/000000_0 ./conversions/uv/tmp_search_date_cate_uv/000000_0 ./conversions/uv/tmp_search_date_algo_country_uv/000000_0 ./conversions/uv/tmp_search_date_country_uv/000000_0 ./conversions/uv/tmp_search_date_channel_uv/000000_0 ./conversions/uv/tmp_search_date_uv/000000_0 ./conversions/uv/tmp_search_date_algo_cate_uv/000000_0 ./conversions/keyword/tmp_search_kw_algo_rate/000000_0 ./conversions/keyword/tmp_search_kw_rate/000000_0 ./conversions/pv/tmp_search_date_cate_pv/000000_0 ./conversions/pv/tmp_search_date_algo_channel_pv/000000_0 ./conversions/pv/tmp_search_date_pv/000000_0 ./conversions/pv/tmp_search_date_algo_pv/000000_0 ./conversions/pv/tmp_search_date_algo_country_pv/000000_0 ./conversions/pv/tmp_search_date_channel_pv/000000_0 ./conversions/pv/tmp_search_date_algo_cate_pv/000000_0 ./conversions/pv/tmp_search_date_country_pv/000000_0 [search@dnode1 2015-04-10]$ </pre> (3)查看所有的目录: <pre name="code" class="java">[search@dnode1 2015-04-10]$ find ./conversions/ -type d ./conversions/ ./conversions/uv ./conversions/uv/tmp_search_date_algo_uv ./conversions/uv/tmp_search_date_algo_channel_uv ./conversions/uv/tmp_search_date_cate_uv ./conversions/uv/tmp_search_date_algo_country_uv ./conversions/uv/tmp_search_date_country_uv ./conversions/uv/tmp_search_date_channel_uv ./conversions/uv/tmp_search_date_uv ./conversions/uv/tmp_search_date_algo_cate_uv ./conversions/keyword ./conversions/keyword/tmp_search_kw_algo_rate ./conversions/keyword/tmp_search_kw_rate ./conversions/pv ./conversions/pv/tmp_search_date_cate_pv ./conversions/pv/tmp_search_date_algo_channel_pv ./conversions/pv/tmp_search_date_pv ./conversions/pv/tmp_search_date_algo_pv ./conversions/pv/tmp_search_date_algo_country_pv ./conversions/pv/tmp_search_date_channel_pv ./conversions/pv/tmp_search_date_algo_cate_pv ./conversions/pv/tmp_search_date_country_pv [search@dnode1 2015-04-10]$ </pre> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |