Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Sep 21 '12 at 16:13

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

add comment

2 Answers

up vote 0 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://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|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
add comment

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
add comment

Your Answer

 
discard

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.