Enter CISCO-LIKE view
After completing user login, the system will automatically enter the command line configuration view. Users can also enter the command line configuration view by typing the “sonic-cli” command, or return to the Linux system interface by typing the “system bash” command.
sonic-cli
Section titled “sonic-cli”[Command] sonic-cli
[Purpose] Enter the Klish command line view
[Notes] This command is executed in the terminal and use system bash command to exit the CLI view.
[Use Cases]
admin@sonic:~$ sonic-clisonic#All commands support help by typing Tab or ”?” to help the user understand the command and its parameters. Tab and ”?” can be used at any level of the command and will show the next possible input command or sub-command. If you have problems using the command line, you can use the help function to get help without having to remember a lot of complicated commands. When you enter a command, press the Tab key, the system will list the set of keywords that can be matched; enter ”? , the system will give the corresponding keyword hint or explanation of the meaning of the parameter. Example:
sonic# show <tab>acl arp counters history image interface link-aggregationlldp mac-address platform running-config startup-config sub-interface trafficsonic# configure terminalsonic(config)# access-list l3 test ingress <tab> <cr>sonic(config)# access-list l3 test <enter>Syntax error: The command is not completedsonic(config)# access-list l3 test1 ingresssonic(config-l3-acl-test1)# ? end Exit to the exec Mode exit Exit from current mode no Negate a command or set its defaults rule Add an access list entry show show running-configsonic(config-l3-acl-test1)# rule ? rule ID (0..500)sonic(config-l3-acl-test1)# rule 1 ? source-mac Specify source mac address destination-mac Specify destination mac address ethernet-type Specify ethernet protocol type outer-vlan Specify outer VLAN id vlan-pri Specify outer VLAN priorityDescription:
- Enter an incorrect command or a command that does not apply to this view will not allow a carriage return to be entered-
- If the command line is not entered completely, press the entry key directly, the system will give a prompt
- Indicates that there are no keywords or parameters in this position, and can be executed by typing directly into the carriage return
[Command] exit
[Purpose] Exit a view
[Notes] This command is executed in any view
show this
Section titled “show this”[Command] show this
[Purpose] Show all configuration commands in the current view
[Usage Scenario] This command would display the currently running configuration on the device, including all the parameters and settings that are currently in effect.
[Notes] This command is executed in any view.
[Use Cases]
sonic(config)# interface ethernet 1sonic(config-if-1)# show thisinterface ethernet 1 ip address 2022::9110/127 ip address 30.11.13.1/30 speed 10000[Command]
do
[Purpose]
Execute commands from other views while not in the system view
[Comment]
Execute commands from other views while not in the system configuration view. For example, the system‑view command write running‑config can be executed in the system configuration view by prefixing it with do, as in do write running‑config.
Note that some configuration commands can only be executed in their corresponding view.
[Use Cases]
sonic(config)# do write running-configsystem bash
Section titled “system bash”[Command] system bash
[Purpose] Exit system view and enter the Linux operating system view.
[View] System view
[Use Cases]
sonic# system bashUse 'exit' to return sonic-cliadmin@sonic:~$[Command]
end
[Purpose]
Return to the system view; in any view, the end command can be used to directly return to the system view.the system View.
[Use Cases]
sonic(config)# endsonic#