首页 > 其他 > 详细

时间日期和查找类命令

时间:2021-05-02 21:55:52      阅读:26      评论:0      收藏:0      [点我收藏+]

时间日期类命令:

date

//显示当前时间

date

//显示当前年月日

date "+%Y-%m-%d"

//设置系统当前时间

date -s "2020-11-05 20:00:00"

cal:日历

//显示本月日历

cal

//显示一年日历

cal 2020

查找类命令:

find:查找满足条件的文件名或者目录

-name:按照名字查找 -user:按照用户查找 -size :按照文件大小查找

//精确搜索

find /Desktop -name kk.txt

//模糊搜索

find Desktop -name ‘kk*‘

find Desktop -name kk*

//忽略大小搜索

find Desktop -iname kk*

字节 byte 1kb=1024b 1mb=1024kb 

//查找大于200M的文件(+n:大于 -n:小于 n:等于,单位有k,M,G)

find /home -size +200M

//通过所属人搜索文件

find Desktop -user fddd

//-5:5分钟之内被更改过的文件(通过时间查找文件)

find Desktop -mmin -5

//按文件类型搜索(f:文件 d:文件夹)

find Desktop -type f

locate:快速定位文件路径

运行前需要先执行updatedb指令创建locate数据库

//快速定位hello.txt文件所在目录

locate hello.txt

grep:过滤查找

-n:显示匹配行及行号     -i:忽略字母大小写

//在hello.txt文件中,查找yes所在行,并且显示行号

cat hello.txt | grep -n "yes"

grep -n "yes" hello.txt

时间日期和查找类命令

原文:https://www.cnblogs.com/fddd/p/14726441.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!