linux常用命令一

来源:互联网 发布:一元云购正版源码 编辑:程序博客网 时间:2024/06/05 13:03

一文件搜索命令

1.which

语法:which [命令名称]

功能:显示系统命令所在的目录

范例;which ls


2.whereis 

语法:whereis  [命令名称]

功能:显示系统命令所在的目录

范例;whereis  ls

与which的唯一区别:which显示别名,whereis可以显示帮助信息


3.find

语法:whereis  [搜索路径] [搜寻关键字] 

功能:查找文件或目录

范例;find /etc -name init  ;find / size 204800;find /home -user samlee




4.locate

语法:locate  [搜寻关键字] 
功能:查找文件或目录
范例;locate filename

注意:速度比find快,查找原理不同,find是从根目录开始,locate是从系统文件数据库,新建的文件查不到



5.updatedb

语法:updatedb
功能:建立整个系统文件的数据库
范例;updatedb

6.grep

语法:grep  [指定字符串][源文件]
功能:在文件中搜索字符串匹配的行并输出
范例;grep ftp /etc/service


                                    二帮助命令 man

1.man

语法:grep  [命令或配置文件]

功能:获得帮助信息
范例;man ls ;man service

man  1 passwd   命令的帮助

man 5 passwd 配置的帮助

2.info

语法:info [任何关键字]

功能:获得帮助信息
范例;info ls ;

3.whatis

语法:whatis apropos [任何关键字]

功能:获得索引的简短说明信息
范例;iwhatis ls ;

         apropos fstab  相当于man -k  查看配置信息







4.help:查看shell内置命令的帮助








0 0