Your Ad Here

The 10 Cisco IOS Router file management commands you must know

Just like a Windows or Linux operating system, the Cisco IOS has its own list of commands to manipulate files, very similar to DOS/Windows commands. These files could be your IOS router operating system, configuration file, or other type of IOS file. Knowing these file commands is a critical requirement for any Cisco admin.

Let’s look at 10 Cisco IOS file management commands you must know.

#1 dir

This shows a directory list of files on a filesystem. To see the options, type dir ?

Router#dir ?

/all List all files

/recursive List files recursively

all-filesystems List files on all filesystems

archive: Directory or file name

cns: Directory or file name

flash: Directory or file name

null: Directory or file name

nvram: Directory or file name

system: Directory or file name

tar: Directory or file name

tmpsys: Directory or file name

xmodem: Directory or file name

ymodem: Directory or file name


You can think of each of these filesystems almost like disk drives in DOS, where you have to put a colon after the name. So, the nvram is called nvram:. The default is to show a directory of the router’s flash as your default current directory is flash:

Router# dir

Directory of flash:/

2 -rwx 18929780 Aug 29 2006 15:49:57 +00:00 c870-advipservicesk9-mz.124-15.T5.bin

3 -rwx 2143 Aug 29 2006 16:42:14 +00:00 running-config

23482368 bytes total (4544512 bytes free)


Every router will have at least flash memory and nvram (non-volatile random access memory).

#2 cd

Change directory: Use cd to change your current directory to a different device or subdirectory on that device. In the following, when I change my directory to the nvram: filesystem and do a dir, I get a list of nvram. I could also cd to a subdirectory after I have created a directory with mkdir.

Router#cd nvram:


Directory of nvram:/

126 -rw- 2143 startup-config

127 —- 5 private-config

128 -rw- 2143 underlying-config

1 —- 49 persistent-data

2 -rw- 0 ifIndex-table

131072 bytes total (116584 bytes free)


#3 copy

This is used to copy the IOS or a config file from and to somewhere. You would use this to copy the router’s configuration off the router to a TFTP server or just make a local backup of it on the router. You would also use the copy command to upgrade the router with a new IOS from a TFTP server.

Here, I am making a local backup of the router’s running configuration:

Router#copy running-config davids-backup-before-upgrade

Destination filename [davids-backup-before-upgrade]?

2181 bytes copied in 3.052 secs (715 bytes/sec)


#4 delete and rm

Very simply, you will use delete to delete files and rm to remove folders/directories. Here, I use delete to delete the backup of my config that I just created:

Router#delete davids-backup-before-upgrade

Delete filename [davids-backup-before-upgrade]?

Delete flash:/davids-backup-before-upgrade? [confirm]


#5 show flash

This is used to show the files in your flash. The command show flash is similar to dir flash: but it provides a little more information on the size and type of flash memory in your router.

Router#show flash

24576K bytes of processor board System flash (Intel Strataflash)

Directory of flash:/

2 -rwx 18929780 Aug 29 2006 15:49:57 +00:00 c870-advipservicesk9-mz.124-15.T5.bin

3 -rwx 2181 Oct 4 2006 04:03:00 +00:00 mybackup-today

23482368 bytes total (4544512 bytes free)


#6 erase and format

It can be a bit confusing why you would erase one type of filesystem, but format another. What you really need to know is that you format flash devices and erase nvram. There are other types of filesystems, and you may erase or format them, depending on their type. The erase command is most used when you want to wipe out the router’s configuration and start with a default configuration. This is done with erase startup-configuration.

Router# erase ?

/all Erase all files(in NVRAM)

/no-squeeze-reserve-space Do not reserve space for squeeze operation

flash: Filesystem to be erased

nvram: Filesystem to be erased

startup-config Erase contents of configuration memory

Router# format ?

flash: Filesystem to be formatted


#7 more

This shows a text / configuration file. Let’s say that you want to view a backup configuration file that you created. Just use the more command to view it:

Router# more my-backup-config


version 12.4

parser config cache interface

parser config interface

{config truncated}

#8 verify

This is used to verify the checksum or compute a MD5 signature for a file.

Router#verify flash:c870-advipservicesk9-mz.124-15.T5.bin

Verifying file integrity of flash:c870-advipservicesk9-mz.124-15.T5.bin…….{truncated}………… Done!

Embedded Hash MD5 : CA8AEC573B197AEC6BD5892DE23C4754

Computed Hash MD5 : CA8AEC573B197AEC6BD5892DE23C4754

CCO Hash MD5 : 9D39672246853C0F31533B6BCB21DFE5

Embedded hash verification successful.

File system hash verification failed for file flash:c870-advipservicesk9-mz.124-15.T5.bin(No such file or directory).


#9 mkdir

Just like in DOS, you use mkdir to create a directory/folder. I would do this to perhaps create an archive folder for backup configurations or old IOS files.

Router# mkdir backup-configs

Create directory filename [backup-configs]?

Created dir flash:backup-configs


#10 fsck

FAT filesystem check is typically used to check your flash filesystem integrity. You may do this if you have experienced some corruption of your IOS files in flash.

Router# fsck

Fsck operation may take a while. Continue? [confirm]


Fsck of flash: complete


While there are so many reasons to use file system commands like these, if I had to select three of the most practical uses for some of the commands listed above, here is my list:

1. Navigating the Cisco IOS filesystems - knowing what configuration files and what IOS files are on the router, perhaps before performing an upgrade.
2. Back up your configuration to the local router or off to a TFTP server, again, perhaps before a backup
3. Performing an upgrade of the Cisco IOS by copying the IOS from a TFTP server to the router.

It’s very important to understand IOS file management commands, what those commands are, and how you can use them in the real world. You don’t want to be stumbling to restore your IOS when the primary IOS is corrupt!