How to configure the System prompt in a Cisco Router or a Cisco Switch?
Posted by: Yasir Irfan
There is a cool handy way to know TTY sessions established in any Cisco Router or a Cisco Switch. By using this feature you can know the number of active telnet sessions from the prompt itself.
Normally whenever you log to any Cisco Router or Switch you will find this menu
ITKE-AS01#
By using the “prompt” command you can see the difference
You might be wondering how come this is possible, ok now let me show you how to enable this feature in a Cisco Router or a Cisco Switch,
Log in to your Cisco Device and use the following command “prompt %h:%n%p”
ITKE-AS01#config t
ITKE-AS01 (config)# prompt %h:%n%p
ITKE-AS01 (config)# exit
In the example I have used three escape sequences to set the prompt name to the hostname (%h), followed by the command number (%n) and then followed by the appropriate prompt character for the current command mode (%p).
You can see the difference in the hostname after applying the “prompt %h:%n%p” command.
ITKE-AS01:1#sho users
Line User Host(s) Idle Location
* 1 vty 0 yasir idle 00:00:00 10.0.0.5
Interface User Mode Idle Peer Address
ITKE-AS01:1#
As the number of TTY session increases you can see the incremental change in the hostname with the sequence number as displayed below.
Example with two TTY sessions
ITKE-AS01:2#sho users
Line User Host(s) Idle Location
1 vty 0 yasir idle 00:00:23 10.0.0.5
* 2 vty 1 itkeuser idle 00:00:00 10.0.0.5
Interface User Mode Idle Peer Address
ITKE-AS01:2#
Example with three TTY sessions
ITKE-AS01:3#sho users
Line User Host(s) Idle Location
1 vty 0 yasir idle 00:01:14 10.0.0.5
2 vty 1 itkeuser idle 00:00:50 10.0.0.6
* 3 vty 2 itkeadmin idle 00:00:00 10.0.0.7
Interface User Mode Idle Peer Address
ITKE-AS01:3#
Example with four TTY sessions
ITKE-AS01:4#sho users
Line User Host(s) Idle Location
1 vty 0 yasir idle 00:01:43 10.0.0.5
2 vty 1 itkeuser idle 00:01:20 10.0.0.6
3 vty 2 itkeadmin idle 00:00:29 10.0.0.7
* 4 vty 3 yasir idle 00:00:00 10.0.0.5
Interface User Mode Idle Peer Address
ITKE-AS01:4#
I you want to disable the TTY display enter the “no prompt” command as shown below.
ITKE-AS01:4#config t
ITKE-AS01:4 (config)# no prompt
Following are the prompt Variables available for the “prompt” command.





