Cisco Set Terminal Length and Width
When issuing commands that give long lines of output on a Cisco device, or when writing automation scripts it is often best to set the terminal length and width to their respective maximums so that output is not truncated and all of the available output is displayed as it is generated. In an automation setting it ensures that you capture the full output from your device, and in the context of a long command output it makes it so lines don't get cut off and you dont have to space through several pages of output. Below I demonstrate how to set the terminal length and width on Cisco IOS and Nexus platforms.
It is often best to set the terminal width to unlimited which can be accomplished by the following command.
$ terminal length 0
This will set it so that all of the output that is available will be returned as it is generated.
Setting the terminal width is less common and also does not have an unlimited width, often times the maximum is something like 511 characters which you can see by typing a
terminal length. Below is the command to set the terminal width.
$ terminal width 511
And below is the command to check what the max width you can set, note that you do not have to press enter on this command, just paste it in with the question mark.
$ terminal width ?
And that is it, it is fairly self explanatory and easy to do. The one thing to also note is that this sets the length and width for your session, it will not set the length and width for all sessions after, so you will need to do this each time you start a new session to your device but you don't always need to modify the width and length of the terminal output unless you are running automated scripts.