How to Use the Cisco IOS File System Commands.

CCNA 200-301

CCNA 200-301

CCNP Enterprise

CCNP Enterprise

CCNP Security

CCNP Security

CCIE Enterprise Lab

CCIE Enterprise Lab

CCIE Security Lab

CCIE Security Lab

CCNP Service Provider

CCNP Service Provider

CCNP Data Center

CCNP Data Center

CCNP Collaboration

CCNP Collaboration

CCIE DC Lab

CCIE DC Lab

ic_r
ic_l
How to Use the Cisco IOS File System Commands.
images

SPOTO focus on IT certification training for 16 years. We always offer the latest tips and valuable study materials for every engineer. Subscribe us and get more news.

Just like working with files from a DOS command prompt in Windows, using files and directories in the Cisco IOS File System (Cisco IFS) involves using the same type of commands. After building a Cisco router, many administrators will not upgrade IOS or access files on the Flash drive for a significant amount of time. However, this is not to say that you will not need to manipulate the files on the Flash drive. Just like working with files from a DOS command prompt in Windows, using files and directories in the Cisco IOS File System (Cisco IFS) involves using the same type of commands. Operate files from a DOS command prompt in Windows. These commands include copy, dir, and format.

Here are some common uses of these commands:

· Back up the IOS before upgrading;

· Upgrade;

· Back up the configuration file before making changes;

· View the text file on the disk;

· Restore the router's Cisco IOS.

Keep in mind some of the most common commands when upgrading and moving files between network devices, saving time and even avoiding a disaster.

Dir

The dir command displays the files in the directory. The default directory is usually the Flash file system. So, typing dir shows the flash:/ directory by default. You can also specify the directory you wish to browse, or you can use the all-filesystems option. If you want to view the files in a subdirectory, you can even use the /recursive switch. Here is an example:

Router# dir

Directory of flash:/

1 -RW- 15183868 c2600-ik9o3s3-mz.122-15.T9.bin

16777216 bytes total (1592488 bytes free)

Router#

Copy

Although most people are familiar with the usual copy command, it can not only copy files from one place to another in a router or switch. In fact, this command is very important for copying files from and to the router.

For example, to upgrade an IOS on a router, you must copy the new IOS from the network or a local relevant console port (through a device such as xmodem). You can also use the copy command to back up the configuration on the router and network, and you can restore the configuration from the network to the router.

When using the copy command, you can use the standard URL format to determine the source and destination. Here is an example of the URL path characteristics of the network destination file:

TFTP:[[//location]/directory]/filename

Ftp:[[//[username[:password]@]location]/directory]/filename

The following example is a feature of the URL path of the local file system. In this example, the path from the router to the boot configuration is nvram:startup-config.

Prefix:[directory/]filename

For example, you can use the same URL structure to back up a boot configuration to a directory named router1 on a TFTP server with an IP address of 1.1.1.1. Here is its characteristic:

Copy nvram: startup-configuration tftp://1.1.1.1/router1/startup-backup-2-8-2006

Show file

The show file command displays information about a specified file or file system. The most useful option for the show file command is to show file information, which displays information about a given file and show file systems, which displays information about the file system. Here is an example:

Router# show file systems

File Systems:

Size(b) Free(b) Type Flags Prefixes

29688 28899 NVRAM RW nvram:

- - opaque rw system:

- - opaque rw null:

- - opaque ro xmodem:

- - opaque ro ymodem:

- - network rw tftp:

* 16777216 1592488 flash rw flash:

- - network rw rcp:

- - network rw pram:

- - network rw ftp:

- - network rw scp:

Router#

More

The more command displays a text file. This command works like Linux - it can view files on disk. In the case of Cisco IOS, you can use this command to view a text file, such as a configuration file or a saved backup configuration file. Here is an example:

Router# more nvram:startup-config

Delete

This command is as it is meant - it deletes the file. This command does not have anything special, except for one point: depending on the router type, deleting a file may not actually free up the file space used by the file. To reclaim the space used by deleted files, you need to use the squeeze command.

Erase or format

You can use the erase or format command to remove the flash drive. The erase command is a more commonly used command. When copying a file, you must be very careful about answering the question of whether you want to delete the file system. Here is an example:

Router# copy running-config flash: test

Destination filename [test]?

Erase flash: before copying? [confirm]

If you just press Enter and accept the default answer, the IOS file will be deleted when the router configuration is backed up to Flash.

Cd and pwd

You can change the directory with the cd command, which works in the same way as DOS and Linux. This command changes the directory to any directory you specify. You can print the current directory using the pwd command, which also works the same way under Linux. Notice that the dir command is used to display the new current directory - the nvram file system - instead of the default Flash.

Router# cd nvram:

Router# pwd

Nvram:/

Router# dir

Directory of nvram:/

27 -rw- 0 startup-config

28 ---- 0 private-config

29688 bytes total (29636 bytes free)

Router#

Mkdir and rmdir

Some routers and switches provide the ability to create and delete directories. You can use the mkdir command to create a directory, and the rmdir command will delete a specific directory. You need to use cd and pwd commands to enter these directories.