Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do you redirect an output to a local file when executing a cisco command?

Let's say I would like to execute "show interface description | inc mcRNC411" and I would like to redirect its output in a local file named C:\output.txt.

Thank you. :)

share|improve this question

migrated from Sep 21 '12 at 16:13

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

This depends on the OS the devices is running (IOX, NX-OS etc) and the version it is on.

For a typical IOS device the details are here.

Use show run | i username | redirect flash0:/output.txt

Although not all devices support using two pipes, and/or the redirect (or tee) command. Again, it depends on your device and OS.

UPDATE To have the update sent to your local computer as C:\output.txt is only possible, when using just the built in features on the switch, via URL redirection. The redirect command saves the output to a URL like the example given, "flash:/output.txt".

This can also be TFTP redirect tftp:// but this requires you to set up a TFTP server. You can see from the help output of the redirect command many other protocols are available;

router#show run | redirect ?
  flash:  Uniform Resource Locator
  ftp:    Uniform Resource Locator
  http:   Uniform Resource Locator
  https:  Uniform Resource Locator
  nvram:  Uniform Resource Locator
  pram:   Uniform Resource Locator
  rcp:    Uniform Resource Locator
  scp:    Uniform Resource Locator
  tftp:   Uniform Resource Locator

Since you are on Windows (I assume, with the mention of "C:\"), if you are using Hyperterminal you can capture the output of commands to a local file: See this reference.

I can't advise you on all terminal emulation programs there are too many, but there are multiple that have this same "capture to file" feature.

Last but not least, a simply copy and paste would surely do? ;)

share|improve this answer
Hi, I tried to execute what you said but it seems that it doesn't write in the C disk. It only writes in the memory of the switch (I think. flash0 of the switch). Is it possible to write it in C local disk of a PC aside from using a tftp server? – JimPaw Sep 21 '12 at 4:31
Sorry I miss understood, I thought you meant local file on the Cisco device :) I will update the answer. – jwbensley Sep 21 '12 at 8:21
thank you for your answer. i would love to do copy paste but i'm doing some automation that's why copy paste is not possible. :) – JimPaw Sep 25 '12 at 4:47

Can you just log the session? Every terminal emulator I've used in... well, since I can remember offers the option to log all your session input and output to a file on the machine you're running it from.

  • Putty Log

Generally, on Windows (which you seem to be using) you can also select and copy the contents of a terminal or CLI window by right clicking on the title/menu bar and selecting the appropriate option from the context menu as well.

  • CMD context menu
share|improve this answer

It's as simple as below:

You login to your router or switch. In the # mode, you type the following command

router# show running-config | redirect tftp:// is your tftp server(hope you have one. If not just download solarwind tftp application and install it on any of your server. Just configure it to show the where the files to be stored by default)

routerbackup is your file name. .doc is the type of file you want. you can have .txt or any other foramt. Now your file will be in the designated folder on in word document format.

That's all :) Enjoy Cisco

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.