10 Cisco IOS file management commands in this article, author David Davis will list our commonly used Cisco IOS file management commands to help us consolidate how to manage flash on Cisco routers, nvram or files in other file systems, and teach you how to easily and quickly back up vro configurations, upgrade vrouters, or simply maintain the IOS file system. Like Windows or Linux, Cisco IOS also has its own file management commands, which are similar to DOS/Windows commands. The files managed and maintained by these commands include the OS files, configuration files, and other types of IOS files. Any Cisco administrator knows that these commands are required. Next let's take a look at ten Cisco IOS file management commands that must be known. #1 dir this command is used to display the file list in the folder. Enter dir? You can view the optional parameters. As follows:/all List all files/recursive List files recursivelyall-filesystems List files on all filesystemsarchive: Directory or file namecns: Directory or file nameflash: Directory or file namenull: directory or file namenvram: Directory or file namesystem: Directory or file nametar: Directory or file nametmpsys: Directory or file namexmodem: Directory or file nameymodem: Directory or file nameRouter # Each file system (such as flash and nvram with colons) is equivalent to a disk partition in the DOS system. You need to add colons after the name. By default, dir lists the files in the Router flash, because the default path is flash: Router # dirDirectory of flash: /2-rwx 18929780 Aug 29 2006 15:49:57 + 16:42:14 c870-advipservicesk9-mz.124-15.T5.bin3-rwx 2143 Aug 29 2006 + running-config23482368 bytes total (4544512 bytes free) router # Each vro must contain at least the flash memory and nvram memory. #2 cd change path. You can use the cd command to change the current path. In the following example, I changed the path to the nvram file system and used the dir command to list the files in the nvram memory. I can also use mkdir to create a folder and run the cd command to enter the folder. Router # cd nvram: Router # dirDirectory of nvram: /126-rw-2143 startup-config127 -- 5 private-config128-rw-2143 underlying-config1 -- 49 persistent-data2-rw-0 ifIndex-table131072 bytes total (116584 bytes free) router #3 copy this command is used to copy IOS or a configuration file to a certain place. You can use this command to copy the vro configuration file to the TFTP server, or copy it to a folder in the vro for backup. You can also use the copy command to copy the new IOS file from the TFTP server to the vro to upgrade the vro. Here I use the copy command to create a local configuration backup for the vrouter: Router # copy running-config davids-backup-before-upgradeDestination filename [davids-backup-before-upgrade]? 2181 bytes copied in 3.052 secs (715 bytes/sec) Router #4 delete and rm are both simple delete commands used to delete files and rm used to delete folders. For example, I used the delete command to delete the configuration backup file I just created: Router # delete davids-backup-before-upgradeDelete filename [davids-backup-before-upgrade]? Delete flash:/davids-backup-before-upgrade? [Confirm] Router #5 show flash command is used to display files in flash. The show flash command is similar to the dir flash command, but the former is richer than the latter, that is, there is an extra flash memory size and type information Router # show flash24576K bytes of processor board System flash (Intel Strataflash) Directory of flash: /2-rwx 18929780 Aug 29 2006 15:49:57 + 04:03:00 c870-advipservicesk9-mz.124-15.T5.bin3-rwx 2181 Oct 4 2006 + mybackup-today23482368 bytes total (4544512 bytes free) router #6 erase and format need to understand why erase is a file system, while format is another system, It may be troublesome. Therefore, you only need to know the file system in format flash and the file system in erase nvram. Other files can be erase and format based on their types. In most cases, the erase command is used to clear the router configuration and restore the configuration. The specific command is erase startup-configuration. Router # erase? /All Erase all files (in NVRAM)/no-squeeze-reserve-space Do not reserve space for squeeze operationflash: Filesystem to be erasednvram: filesystem to be erasedstartup-config Erase contents of configuration memoryRouter # format? Flash: Filesystem to be formattedRouter #7 more command can display the content of the text/configuration file. For example, if you want to view a backup configuration file, you can use the more command to view the file content: Router # more my-backup-config! Version 12.4 parser config cache interfaceparser config interface {config truncated} #8 verify this command is used to verify or calculate the MD5 checksum of a file. Router # verify flash: c870-advipservicesk9-mz.124-15.T5.binVerifying file integrity of flash: c870-advipservicesk9-mz.124-15.T5.bin ................... Done! Embedded Hash MD5: invalid Hash MD5: CA8AEC573B197AEC6BD5892DE23C4754CCO Hash MD5: 9D39672246853C0F31533B6BCB21DFE5Embedded hash verification successful. file system hash verification failed for file flash: c870-advipservicesk9-mz.124-15.T5.bin (No such file or directory ). router #9 mkdir is the same as the DOS environment. You can also use the mkdir command in the vro to create a folder. Generally, I use this command to create a backup folder to store backups of configuration files or ISO files. Router # mkdir backup-configsCreate directory filename [backup-configs]? Created dir flash: backup-configsRouter #10 fsckFAT file system detection is mainly used to detect the integrity of the flash file system. If you feel that the ISO file is damaged, you can use this command to check the file system. Router # fsckFsck operation may take a while. Continue? [Confirm] ...... Fsck of flash: completeRouter # The commands described above are the most commonly used IOS commands. If you want to select the three most commonly used commands, that is the command used in the following three cases: 1. view the Cisco IOS File System-Use this command to view the configuration file and IOS file in the vro, especially before upgrading the vro. 2. Import the configuration to the vro or export the configuration from the vro to the TFTP server. The most common commands used for backup are as follows. 3. Copy the ISO file from the TFTP server to the vro. This is a required command for upgrading Cisco IOS. Remember that all the file management commands listed above are very important. You should know the functions of these commands and how to use them. If the router ISO is damaged, but you do not know how to recover it, it would be too embarrassing.