cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
12094
Views
1
Helpful
1
Replies

Cisco IOS: How to clear the terminal?

In a Cisco IOS terminal session I'd like to be able to clear the screen similar to the clear command or the ctrl-L key combination on a Linux/UNIX box. Most sources suggest to reside to terminal emulator features for that functionality, but that is not appealing to me. One Cisco community conversation suggests to use a tcl shell to emit an escape sequence like so:

proc clear_term { } {
    exec "terminal international"
    puts "\x1B\x5B\x32\x4A\x1B\x5B\x30\x3B\x30\x48"
}


I gave that a try. The escape sequence works as expected if the terminal session was in international mode already when the tcl script is run, although obviously the script tries to take care of that temporarily itself.

Did IOS behavior change in recent years in this regard? The linked Cisco community conversation is from 2007, I am trying this on IOS 15 though. Is there something I can do get this to work regardless of the terminal state (international or not)?

1 Reply 1

scdugan
Level 1
Level 1

Another way to do this is to use the terminal Menu system. With the commands that follow, you are building a menu called CLEARSCREEN that clears the screen then exits the menu system with a carrige return.  Then an alias command to make "cls" call the menu.

 

menu CLEARSCREEN command 1 menu-exit
menu CLEARSCREEN clear-screen
menu CLEARSCREEN default 1
alias exec cls menu CLEARSCREEN

 

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: