Cisco Command Output Redirect to a local file

23,181

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://192.168.0.1/myfile.txt 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:
23,181

Related videos on Youtube

JimPaw
Author by

JimPaw

Updated on September 18, 2022

Comments

  • JimPaw
    JimPaw over 1 year

    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. :)

  • Dima Fomin
    Dima Fomin over 11 years
    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?
  • jwbensley
    jwbensley over 11 years
    Sorry I miss understood, I thought you meant local file on the Cisco device :) I will update the answer.