linux文件搜索命令_linux查找文件夹命令
linux文件搜索命令由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“linux查找文件夹命令”。
文件搜索命令:which 名称:which
路径:/usr/bin/which 执行权限:所有用户 语法:which [命令名称]
功能描述:显示系统命令所以目录 范例:$which ls
文件搜索命令:find
命令名称:find
命令所在路径:/usr/bin/find 执行仅限:所有用户
语法:find [搜索路径][搜索关键字] 功能描述:查找文件或目录 范例:
$find /etc –name init
在目录/etc中查找文件init
(通配符 *init* 表示文件中包含init的文件)init???
init后面还有三个字符的文件 $find /-size +204800
在根目录下查找大于100M的文件 $find /-user sam
在根目录下查找所有者为sam的文件 $find /etc –ctime-1
在/etc下查找24小时内修改过属性的文件和目录
(atime 被访问过 a-acce;mtime文件内容被修改过 m-modify)-表示多少时间之内 +表示大于多长时间。$find /etc –size +163840 –a –size-204800 在/etc下查找大于80M小于100M的文件 a 表示逻辑与 结果取两个条件的交集 o 表示逻辑或
$find /etc –name inittab –exec ls –l {};在/etc下查找inittab文件并显示详细信息 {} find查询的结果
转义符 让命令按它本来的意思执行 exec还可以换成ok 加ok会询问执行 文件搜索指令:locate 指令名称:locate
原意:list files in databases 路径:/usr/bin/locate 执行权限:all user
语法:locate [搜索关键字] 功能描述:寻找文件或目录 范例:$locate file
列出所有跟file相关的文件 文件搜索指令:updatedb 指令名称:updatedb
原义:update the slocate database 路径:/usr/bin/updated 执行权限:root 语法:updatedb
功能描述:建立整个系统目录文件的数据库 范例:#updatedb 文件搜索命令:grep 命令名称:grep 路径:/bin/gerp 执行权限:所有用户
语法:grep [指定字串][源文件]
功能描述:在文件中搜寻字串匹配的行并输出 范例:#grep ftp /etc/services
帮助命令:man
原意:manual 路径:/usr/bin/man 执行权限:所有用户
语法:man[命令或配置文件] 功能描述:获得帮助信息 范例:$man ls
查看ls命令的帮助信息
$man services
查看配置文件services的帮助信息 帮助指令:info 指令名称:info 原意:information 路径:/usr/bin/info 执行权限:all user 语法:info [任何关键字] 功能描述:获得帮助信息 范例:$info ls
查看ls指令的帮助信息 帮助指令:whatis
名称:whatis apropos makewhatis
原意:search the whatis database for strings 指令所在路径:/usr/bin/whatis apropos
/isr/sbin/makewhatis 执行权限:all user;root
语法:whatis apropos [任何关键字] 功能描述:获得索引的简短说明信息 范例:$whatis ls
$apropos fstab
相当于man –k
#makewhatis
建立whatis和apropos搜索使用的数据库,当使用这两个命令发生错误时,就是whatis database没有建立