Linux常用命令-文件搜索命令
2016-07-14 14:13
513 查看
1) which
语法: which [命令名称]
功能描述: 显示系统命令所在目录
范例: which ls
2) find
语法: find [搜索路径] [搜索关键字]
功能描述: 查找文件或目录
范例; find /etc -name init 在目录/etc中查找init
find / -size +204800 在根目录下查找大于100MB的文件
find / -user sam 在根目录下查找所有者为sam 的文件
find /etc -ctime -l 在/etc下查找24小时内被修改过属性的文件和目录
find /etc -size +163840 -a size -204800 在/etc下查找大于80MB小于100MB的文件
find /etc -name inittab -exec ls -l {} \; 在/etc下查找inittab 文件并显示其详细信息
3) locate list files in databases
语法:locate [搜索关键字]
功能描述: 寻找文件或目录
范例: locate file 列出所有跟file相关的文件
4) updatedb update the slocate database
语法: updatedb
功能描述: 建立整个系统目录文件的数据库
范例: updatedb
5) grep
语法: grep [指定字符] [源文件]
功能描述: 在文件中搜寻字符匹配的行并输出
范例: grep ftp /etc/services
6) man manual
语法: man [命令或配置文件]
功能描述: 获得帮组信息
范例: man ls 查看ls命令的帮助信息
man services 查看配置文件services的帮助信息
7) info
8)whatis
语法: whatis apropos [关键字]
功能描述: 获得索引的简单说明信息
范例: whatis ls
apropos fstab 相当于man -k
makewhatis 建立whatis和apropos搜索使用的数据库, 当使用这两个命令发生错误时,就是whatis database 没有建立
语法: which [命令名称]
功能描述: 显示系统命令所在目录
范例: which ls
2) find
语法: find [搜索路径] [搜索关键字]
功能描述: 查找文件或目录
范例; find /etc -name init 在目录/etc中查找init
find / -size +204800 在根目录下查找大于100MB的文件
find / -user sam 在根目录下查找所有者为sam 的文件
find /etc -ctime -l 在/etc下查找24小时内被修改过属性的文件和目录
find /etc -size +163840 -a size -204800 在/etc下查找大于80MB小于100MB的文件
find /etc -name inittab -exec ls -l {} \; 在/etc下查找inittab 文件并显示其详细信息
3) locate list files in databases
语法:locate [搜索关键字]
功能描述: 寻找文件或目录
范例: locate file 列出所有跟file相关的文件
4) updatedb update the slocate database
语法: updatedb
功能描述: 建立整个系统目录文件的数据库
范例: updatedb
5) grep
语法: grep [指定字符] [源文件]
功能描述: 在文件中搜寻字符匹配的行并输出
范例: grep ftp /etc/services
6) man manual
语法: man [命令或配置文件]
功能描述: 获得帮组信息
范例: man ls 查看ls命令的帮助信息
man services 查看配置文件services的帮助信息
7) info
8)whatis
语法: whatis apropos [关键字]
功能描述: 获得索引的简单说明信息
范例: whatis ls
apropos fstab 相当于man -k
makewhatis 建立whatis和apropos搜索使用的数据库, 当使用这两个命令发生错误时,就是whatis database 没有建立
相关文章推荐
- centos6.8下mysql5.6源码安装并实现主从同步
- linux ubuntu16.04 LTS 32 bit安装android studio
- IT--linux--排错--log
- linux expect自动登录ssh,ftp
- 使用 udev 高效、动态地管理 Linux 设备文件
- 关于find命令
- CentOS启用sudo,禁用root远程登录
- centos7下lamp的分布式安装
- centos下lnmp的安装
- Linux启动提示Kernel panic - not syncing: Attempted to kill init解决办法
- centos 安装 phalcon
- 进程的虚拟地址划分
- linux学习8:文件权限
- Linux 中 mysql 的主从复制配置
- linux终端快捷键
- 在 Linux 上管理加密密钥的最佳体验
- Linux用户态程序计时方式详解
- LINUX最大线程数及最大进程数
- Linux date命令详解
- Qt Weekly #23: Qt 5.5 enhancements for Linux graphics and input stacks(翻译)