which搜索的文件要有可执行权限而且要PATH环境变量中
whereis搜索也是有一定局限性
locate也是一个搜索的命令,需要yum install -y mlocate
直接locate ls是搜索不到的,需要更新下库updatedb,再次locate ls就可以,所以locate搜索也是有一定局限性,每次搜索,必须刷新库updatedb才可以搜到
find是很精准的去搜索一个命令或文件,
find /tmp/ -name 'aminglinux'
find /tmp/ -name 'aming*'
find搜索第二种类型:find /tmp/ -type d(按照文件类型来搜索)
find /tmp/ -type f
find /tmp/ -mtime +10(mtime是创建时间或者修改时间,+10是大于10天的,—10是小于10天的)
find /tmp/ -mtime -365(一年以内的)
find /tmp/ -mmin -5(5分钟之内)
find /tmp/ -type f -name aminglinux(也可以组合一起用)
find /tmp/ -type f |xargs -i mv {} {}.bak(更改名字)
转载于:https://blog.51cto.com/969301352/1689699