IOS Tips and Tricks, Part 5

Since IOS flash has a general-purpose file system, you can copy any files you want into it using the standard copy source destination syntax.

  • For example, if you want to copy the running config into flash and name it “Alan.txt”, you could use copy running-config flash:Alan.txt.
  • If you want to copy the startup config into flash and name it “Bruce.txt”, you could do copy startup-config flash:Bruce.txt.
  • In fact, you can copy any arbitrary file from a TFTP server into flash using copy tftp flash.

Try copy ? to see the other source options, but be careful when copying into flash you don’t inadvertently erase the contents when prompted  (go easy on that <Enter> key, because [confirm] is the default!).

Assuming that all goes well, after the copy completes, the file will appear in the directory listing for flash, which you can view with either show flash or dir flash: (if using dir flash:, don’t forget the colon after flash).

How do you remove a file from flash? To remove the file “Craig.txt” from flash, you could use delete flash:Craig.txt.

When referencing the running and startup configs, you can shortcut things like running-config and startup-config, and with newer IOS, you don’t even need to specify that flash is the target (it’s assumed unless otherwise specified). Thus, to get the same results, you could just do:

  • Router#copy run Alan.txt
  • Router#copy start Bruce.txt
  • Router#dir
  • Router#delete Craig.txt

Note that show flash and dir will display the names and statistics of the files in flash, but how do you see the contents of the files in flash? For example, if a file named Doug.txt is resident in flash, how can you see what’s in it? If it’s a text (ASCII) file, you can view it using more filename. For example, to see the contents of Doug.txt, you would use more flash:Doug.txt, or simply more Doug.txt (in either case, don’t forget to supply the file extension).

And don’t forget, you can disable the twenty-four line per screen display default using terminal length 0 (and resume it with terminal length 24).

What if the file is not ASCII, such as an IOS image, which is a compressed binary file? In that case you’ll get a hex dump of the file, along with the attempted ASCII decode, but you won’t likely be able to make sense of it.

Okay, that’s it for now!

In this article

Join the Conversation