Cisco Command Prompt Tricks and Gotchas

I guess most of you are familiar with the usual CLI prompt, be it on a Linux system, Cisco device, or whatever. On a standard *nix machine, you can modify your prompt appearance, and its configuration is specific to the shell you’re using – BASH, KSH, ZSH, etc.

Recently, I was surprised to figure out that you can also modify the standard Cisco prompt. I owe this knowledge to my friend and mentor Vladi – thanks! 🙂 Interestingly, the only place I could find more info on the matter was the Cisco IOS in a Nutshell book.

Back on topic. A regular prompt would read

[hostname]>
or
[hostname]#

You can modify the prompt directly with prompt command, and use any of the following escaped variables with it:

%% - the percent character itself
%h - hostname
%n - tty command counter number
%p - prompt character (> or #)
%s - white space character
%t - tab character

For example:

Router#config t
Router (config)# prompt %h:%n%p
Router:1# show ver
[output omitted]
Router:2#

So now you can either modify your prompt, or play a trick on a fellow colleague 😀

Advertisements

One thought on “Cisco Command Prompt Tricks and Gotchas”

  1. Pretty great post. I just stumbled upon your weblog and wished to mention that I
    have truly enjoyed browsing your weblog posts. In any case I’ll be subscribing on your rss feed and I am hoping you
    write once more soon!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s