# 2. 命令行(CLI)操作

本部分包括以下内容：

* 命令模式
* 命令模式的切换
* CLI命令的编辑技巧
* 常见CLI错误提示
* 使用 no 和 default 选项

命令模式 交换机和路由器的命令是按模式分组的，每种模式中定义了一组命令集，所以想要使用某个命令，必须先进入相应的模式。各种模式可通过命令提示符进行区分，命令提示符的格式是： 提示符名模式 提示符名一般是设备的名字，交换机的默认名字“Switch”，路由器的默认名字是“Router”（锐捷设备的默认名字是“Ruijie”），提示符模式表明了当前所处的模式。如：“>”代表用户模式，“#”代表特权模式。 以下是常见的几种命令模式：

| 模式                         | 提示符                | 说明                   |
| -------------------------- | ------------------ | -------------------- |
| User EXEC用户模式              | `>`                | 可用于查看系统基本信息和进行基本测试   |
| Privileged EXEC特权模式        | `#`                | 查看、保存系统信息，该模式可使用密码保护 |
| Global configuration全局配置模式 | `(config)#`        | 配置设备的全局参数            |
| Int configuration接口配置模式    | `(config-if)#`     | 配置设备的各种接口            |
| Line configuration线路配置模式   | `(config-line)#`   | 配置控制台、远程登录等线路        |
| Router configuration路由配置模式 | `(config-router)#` | 配置路由协议               |
| Config-vlanVLAN配置模式        | `(config-vlan)#`   | 配置VLAN参数             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kerwin.gitbook.io/ruijie/jiao-huan-chan-pin/path1/2.-ming-ling-hang-cli-cao-zuo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
