Lessons · Network switches · looking without leaving
do: one command somewhere else, and back
Every mode has its own vocabulary, so a show command inside a port is not a wrong command -- it is a command from another room. `do` runs it there and puts you back.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
This is the single most common moment of confusion for anybody new to IOS, and it looks like the switch being awkward. It is not; it is one word.
How to think about it
When something you are sure of is refused, read the prompt. If it says (config) or (config-if), the fix is usually three letters.
Worked example
enableIn.
configure terminalConfiguring.
interface gi0/2Inside a port. The prompt says so.
switchport mode accessThis belongs here.
show vlan briefAnd this does not. The command is right; the room is wrong.
do show vlan briefSame command, run next door, and you are still inside the port.
description Front deskWhich the next line proves, because this only works in here.
endDone.
Your turn
Check the VLANs without leaving interface configuration.
show vlan brief
Console into a switch
The trap
Typing exit to run one show command. It works, and then you are somewhere else and have to find your way back.