let's shell---Find 指令用法
来源:互联网 发布:win7电脑摄像头软件 编辑:程序博客网 时间:2024/06/03 14:07
以前学习shell命令的时候感觉find指令全盘搜索,简直要命所以就没怎么关注这个,没想到在工作还是用到了。。。可见理论和实践还是差距很大的
1. 找出 . 底下的 php 檔案
find . -name "*.php"
2. 找出 . 底下非 php 副檔名檔案
find . -not -name "*.php"3. 刪除 . 底下 php 檔案,有兩種作法
# 系統詢問之後才刪除# 先把 -exec 後面的東西先清掉, 用 -print 來先確認輸出# rm 可以多用 -i 的參數來加以確認find . -name "*.php" -exec rm -i {} \;## 系統直接刪除find . -delete -name "*.php"find . -name "*.php" | xargs /bin/rm -rf4. 如何刪除 7 天前之料呢?
find /path_name -type f -mtime +7 -exec rm '{}' \;find /path_name -type f -mtime +7 | xargs /bin/rm -rffind /path_name -delete -type f -mtime +75. 找出7天以內修改的資料
find . -type f -mtime -7 -name "*.php"6. find 後只顯示目錄名稱不顯示路徑
find . -maxdepth 1 -type d -exec basename {} \;find . -maxdepth 1 -type d | awk -F"/" '{print $NF}'find . -maxdepth 1 -type d | sed 's!.*\/\([^\/]*\).*!\1!g'7. find 後只顯示目錄名稱不顯示路徑,也不顯示第一個 . 目錄
find . -maxdepth 1 -mindepth 1 -type d -exec basename {} \;8. -mmin (minutes) or -mtime (24 hour periods, starting from now) For example:
find . -mtime 0 # find files modified between now and 1 day ago # (i.e., within the past 24 hours)find . -mtime -1 # find files modified less than 1 day ago # (i.e., within the past 24 hours, as before)find . -mtime 1 # find files modified between 24 and 48 hours agofind . -mtime +1 # find files modified more than 48 hours ago find . -mmin +5 -mmin -10 # find files modifed between # 6 and 9 minutes ago
阅读全文
0 0
- let's shell---Find 指令用法
- let's shell---Crontab的格式
- Shell指令:find指令的使用
- shell find用法
- [shell]find的用法
- shell find用法
- [Shell][find]用法
- shell find命令用法
- MAC shell指令用法
- find指令用法 以及粘滞位
- Linux系统find指令用法
- linux下find指令用法
- Package OpenCV not found? Let’s Find It.
- shell find 命令的用法
- let's shell---rm -rf 命令居然删除目录失败
- let's shell---ln 命令使用参数详解
- let's shell---tcpdump命令使用参数详解
- stat、find指令的相关用法
- jsonp介绍与优缺点
- 利用静态变量记录并控制递归函数的执行次数
- 交换两个变量的值,不使用第三个变量的四种方法
- 分析一段H264视频数据
- SpringMVC学习笔记(4)-----访问静态页面
- let's shell---Find 指令用法
- Node.js介绍
- LeetCode 132. Palindrome Partitioning II
- [ZJOI2006]物流运输 (最短路+dp)
- [SDUT](2121)数据结构实验之链表六:有序链表的建立
- Office转换技巧之转换pdf格式文件的方法分享
- codeforce 864C Bus(模拟)
- 【BZOJ 4569】【SCOI】【萌萌哒】【并查集】【倍增均摊优化】
- 【后缀数组】不可重叠最长重复子串