Chinaunix首页 | 论坛 | 博客
  • 博客访问: 63937
  • 博文数量: 15
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 207
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-22 16:04
文章分类
文章存档

2014年(15)

分类: LINUX

2014-02-14 10:53:47

1.命令有两种类型:

   builtion:在shell中实现的即为内建命令;
   外部命令:在文件系统上的某位置有一个与命令名称对应的可执行文件;

2.使用type命令判断命令的类型:
1
2
3
4
    
[root@localhost ~]# type cd
cdis a shell builtin
[root@localhost ~]# type basename
basenameis /bin/basename

3.shell:事先通过一个变量设定好了多个路径,当用户输入命令时,shell会自动到这些路径(由左往右)下查看与命令名称相同的可执行文件——>环境变量:$PATH
查找到并执行过的命令会被保存至一个hash查找表中;可以使用hash命令查看此表;
如:
1
2
3
4
5
6
7
    
[root@localhost ~]# hash
hits    command
3    /usr/bin/tail
1    /bin/bash
1    /bin/more
5    /sbin/ifconfig
1    /bin/cat

4.内建命令:

   # help 命令名
   例如:help cd    

5.外部命令:
   # 命令名 --help
6.使用手册:manual
   # man  命令
               有很多使用段落:
               名称:   NAME        
               概要:   SYNOPSIS
               选项:    OPTIONS
               例子:   EXAMPLES
               描述:    DESCRIPTION
        使用帮助中命令格式中的字符意义:
               [ ]: 可选的部分;
               {a|b}: 分组,a和b作为一个使用单元来使用,
               |: 或者,只能选其一;
               <>: 必不能少的部分;
               ...: 同类内容可以出现多个;


       man命令的简要使用机制:
          翻屏:
                  空格键:向文件尾部翻一屏;
                   b: 向文件首部翻一屏;
                   回车键:向文件尾部翻一行;
                   k: 向文件首部翻一行;
                   Ctrl+d: 向文件尾部翻半屏;
                   Ctrl+u: 向文件首部翻半屏;

         文本搜索:
                  /keyword: 向文件尾部搜索;
                   ?keyword:向文件首部搜索;
                      n:跟搜索命令相同的方向(下一个);
                       N:路搜索命令相反的方向(上一个);
           q: 退出;

       man命令的分段机制:
       1-8:  

       1:用户命令    User Command
       2:系统调用    System Calls
       3:库调用       C Library Functions
       4:设备文件    Devices and Special Files
       5:文件格式    File Formats and Conventions
       6:游戏          Game et. Al.
       7:杂项          Miscellanea
       8:管理命令    System Administration tools and Demons  

       从1-8顺序查找
       查看某关键字在哪些段落中使用帮助,可使用:
       #whatis Keybord  ---精确查找

1
2
3
    
[root@localhost ~]# whatis ifconfig
ifconfig(8)  - configure a network interface
[root@localhost ~]#

             提示:如果whatis的数据库尚未生成,可以使用makewhatis手动进行
       #man -k keybord  ---模糊查找
1
2
3
4
5
6
    
[root@localhost ~]# man -k ifconfig
ifcfg                (8)  - simplistic script whichreplaces ifconfigIP managment
ifconfig(8)  - configure a network interface
ifconfig_selinux     (8)  - Security Enhanced Linux Policy forthe ifconfigprocesses
pifconfig            (8)  - display information about a network interface
[root@localhost ~]#


   7. info 命令:获取在线文档

   8.很多应用程序自带很多的文档:/usr/shared/doc
                               ChangeLog,INSTALL,README
   9.Google


   10.发行版的官方文档
阅读(1440) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~