命令与文件的查询 which whereis locate find
来源:互联网 发布:苹果电脑c语言编程软件 编辑:程序博客网 时间:2024/06/07 06:59
一:which
which查找脚本文件也就是我们的系统命令
用法:which [command] 默认根据我们PATH路径去查找,但是不同的用户肯定设置不同的PATH,所以就像普通用户查找不到一些/sbin/下的命令是正常的。但是有的命令我自己可以用,但是查找不到就奇怪了,比如”cd”命令,实际上它是bash内置命令。
student@student:$ type cdcd is a shell builtin
参数:-a : 将所有由PATH路径下可查找的命令均列出,而不只找到第一个命令。
二:whereis和locate
whereis和locate 的查找方式都是查找我们本地的数据库,所以速度相当的快。
whereis用法:whereis filename 查找文件名的位置
whereis参数:-b :只查找二进制的文件
-m:查找说明文件manual路径下的文件
-s:只查找source源文件
-u:查找除了上面的三个选项的其他文件。
loacte用法:locate filename :注意:filename可以不全,所以适用于只记得一般的文件名的查找。
locate参数:-i:忽略大小写的差异
-r:后面可接正则表达式的显示方式
三:find
find查找命令的优点是有很强大的功能,但是缺点是find是查找磁盘,所以速度特别慢。下面介绍下find:
与时间有关的参数
(1):-mtime n :n为数字,意思是在n天之前的”一天之内修改的文件”; eg:find / -mtime 0 表示从现在开始到24小时前有改动过内容的文件。
(2):-mtime +n:意思是在n天之前被更改过的文件;eg:find / -mtime 3 表示从现在开始到三天前有改动过内容的文件。
(3):-mtime -n:意思是在n天到现在被修改过的文件。
(4):-newer file:file 为一个存在的文件,表示列出比file更加新的文件。eg:find / -newer file 表示找出系统中比file新的文件。
与用户或者用户组有关的参数
(5):-uid n:n为uid,表示uid为n的用户所拥有的文件。eg:find / -uid 1000 表示查找出系统下uid为1000的用户拥有的文件
(6):-gid n:n为gid。
(7):-user name:name 为用户账号名称。 eg:find / -user student 表示查找出系统下用户名为student的用户拥有的文件
(8):-group name:name 为组的名称。
(9):-nouser :寻找文件所有者不存在于/etc/passwd的人。 eg:find / -nouser 表示查找文件所有者不存在的文件。
(10):-nogroup:寻找文件所有者不存在于/etc/group的人。
与文件权限以及名称有关的参数
(11):-name filename:查找文件名为filename的文件。eg:find / -name passwd 表示查找/下文件名叫passwd的文件。
(12):-size [+-]SIZE:查找比SIZE大或者小的文件,eg:-size +50k 表示查找比50k大的。
(13):-type [f,d,l,s]:f:正规文件,d:目录,l:链接文件,s:socket文件
(14):-perm mode:查找文件属性刚好等于mod的文件。
(15):-perm -mode:查找的文件属性必须全部包括mode(也就是>=mode)就会被查找出来。权限之间是”且”的关系。
(16):-perm +mode:只要包含其中一个权限就可以。权限之间是”或”的关系。
- 命令与文件的查询 which whereis locate find
- Linxu命令与文件的搜索 - which, whereis, locate, find
- Linux 文件路径查询命令(find、locate、which、whereis)
- 文件查找命令find,locate,whereis,which
- 文件查找命令-which,whereis,locate,find
- 文件搜索命令 locate、find、whereis、which
- linux学习(9)命令与文件的搜寻(which,whereis,locate,find)
- Linux五个查询命令 -- find/locate/whereis/which/type
- linux中Find、whereis、locate、which查找文件命令总结
- linux中Find、whereis、locate、which查找文件命令总结
- 查找文件命令---find, locate, whereis, which, type
- linux中Find、whereis、locate、which查找文件命令详解
- Linux下which、whereis、locate、find 命令查找文件
- Linux下which、whereis、locate、find 命令查找文件
- Linux下which、whereis、locate、find 命令查找文件
- Linux下which、whereis、locate、find 命令查找文件
- Linux文件查找命令详解-which whereis find locate
- linux 查看文件命令 file which whereis locate find
- 从缓存角度说post和get的区别(摘抄)
- 准备做个门户网站--美丽邵阳(一)
- Linux 学习笔记 (四)Ubuntu14.04 解决上网问题安装无线网卡驱动
- golfing interface学习
- Context的使用(Using Context)
- 命令与文件的查询 which whereis locate find
- 学习笔记之eclipse中处理js文件报错
- cisco命令行手册
- <仅是自己做笔记。。。系列-13>输入两个整数 n 和 m,从数列1,2,3.......n 中 随意取几个数, 使其和等于 m ,要求将其中所有的可能组合列出来.
- 数组
- 关于们MySQL 插入空值" '' " 与null
- Java基础知识 二(关键字、标识符、注释、数据类型、数据类型的转换)
- android 总结学习 简单的UI控件
- 浅析:横竖屏切换时候Activity的生命周期