The syntax for
specifying a local file system is
filesystem:[//modules/].
This table describes file systems that you can reference on your
device.
Table 1 File System Syntax Components
File System Name
Module
Description
bootflash
sup-active
sup-local
Internal CompactFlash memory located on the active supervisor
module used for storing image files, configuration files, and other
miscellaneous files. The initial default directory is bootflash.
sup-standby
sup-remote
Internal CompactFlash memory located on the standby supervisor
module used for storing image files, configuration files, and other
miscellaneous files.
slot0
—
External CompactFlash memory installed in a supervisor module
used for storing system images, configuration files, and other miscellaneous
files.
volatile
—
Volatile random-access memory (VRAM) located on a supervisor
module used for temporary or pending changes.
nvram
—
Nonvolatile random-access memory (NVRAM) located on a
supervisor module used for storing the startup-configuration file.
log
—
Memory on the active supervisor that stores logging file
statistics.
system
—
Memory on a supervisor module used for storing the
running-configuration file.
debug
—
Memory on a supervisor module used for debug logs.
usb1
—
External USB flash memory installed in a supervisor module
used for storing image files, configuration files, and other miscellaneous
files.
usb2
—
External USB flash memory installed in a supervisor module
used for storing image files, configuration files, and other miscellaneous
files.
Directories
You can create directories on bootflash: and external flash memory
(slot0:, usb1:, and usb2:). You can navigate through these directories and use
them for files.
Files
You create and access files on bootflash:. volatile:, slot0:, usb1:, and usb2: file systems. You can only access files on the system: file systems. You can use the debug: file system for debug log files specified in the debug logfile command.
You can download files, such as system image files, from remote servers using FTP, Secure Copy (SCP), Secure Shell FTP (SFTP), and TFTP. You can also copy files from an external server to the device, because the device can act as an SCP server.
Formatting External Flash Devices
You can format an external flash device to erase the contents
and restore it to its factory-shipped state.
Displays the name of your current default directory.
Step 2
cd {directory | filesystem:[//module/][directory]}
Example:
switch# cd slot0:
Changes to a new current directory. The file system, module, and directory names are case sensitive.
Creating a Directory
You can create directories in the bootflash: and flash device file
systems.
SUMMARY STEPS
1.
(Optional) pwd
2.
(Optional) cd {directory |
filesystem:[//module/][directory]}
3.mkdir
[filesystem:[//module/]]directory
DETAILED STEPS
Command or Action
Purpose
Step 1
pwd
Example:
switch# pwd
(Optional)
Displays the name of your current default directory.
Step 2
cd {directory |
filesystem:[//module/][directory]}
Example:
switch# cd slot0:
(Optional)
Changes to a new current directory. The file system, module, and
directory names are case sensitive.
Step 3
mkdir
[filesystem:[//module/]]directory
Example:
switch# mkdir test
Creates a new directory. The
filesystem argument is case sensitive. The
directory argument is alphanumeric, case
sensitive, and has a maximum of 64 characters.
dir [directory | filesystem:[//module/][directory]]
Example:
switch# dir bootflash:test
Displays the directory contents. The default is the current working directory. The file system and directory names are case sensitive.
Deleting a Directory
You can remove directories from the file systems on your device.
Before You Begin
Ensure that the directory is empty before you try to delete it.
SUMMARY STEPS
1.
(Optional) pwd
2.
(Optional) dir [filesystem:[//module/][directory]]
3.rmdir [filesystem:[//module/]]directory
DETAILED STEPS
Command or Action
Purpose
Step 1
pwd
Example:
switch# pwd
(Optional)
Displays the name of your current default directory.
Step 2
dir [filesystem:[//module/][directory]]
Example:
switch# dir bootflash:test
(Optional)
Displays the contents of the current directory. The file system, module, and directory names are case sensitive.
If the directory is not empty, you must delete all the files before you can delete the directory.
Step 3
rmdir [filesystem:[//module/]]directory
Example:
switch# rmdir test
Deletes a directory. The file system and directory name are case sensitive.
Accessing Directories on the Standby Supervisor Module
You can access all file systems on the standby supervisor module (remote) from a session on the active supervisor module. This feature is useful when copying files to the active supervisor modules requires similar files to exist on the standby supervisor module. To access the file systems on the standby supervisor module from a session on the active supervisor module, you specify the standby supervisor module in the path to the file using either filesystem://sup-remote/ or filesystem://sup-standby/.
Working with Files
This section describes how to work with files on the Cisco NX-OS device.
The file system, module, and directory names are case sensitive.
The target-filename argument is alphanumeric, case sensitive, and has a maximum of 64 characters. If the target-filename argument is not specified, the filename defaults to the source-filename argument value.
Copying Files
You can make copies of files, either within the same directory or on another directory.
Note
Use the dir command to ensure that enough space is available in the target file system. If enough space is not available, use the delete command to remove unneeded files.
SUMMARY STEPS
1.
(Optional) pwd
2.
(Optional) dir [filesystem:[//module/][directory]]
Copies a file. The file system, module, and directory names are case sensitive. The source-filename argument is alphanumeric, case sensitive, and has a maximum of 64 characters. If the target-filename argument is not specified, the filename defaults to the source-filename argument value.
Deleting Files
You can delete a file from a directory.
SUMMARY STEPS
1.
(Optional) dir [filesystem:[//module/][directory]]
Displays the last lines of a file. The default number of lines is 10. The range is from 0 to 80 lines.
Redirecting show Command Output to a File
You can redirect show command output to a file on bootflash:, slot0:, volatile:, or on a remote server. You can also specify the format for the command output.
Redirects the output from a show command to a file.
Finding Files
You can find the files in the current working directory and its subdirectories that have names that begin with a specific character string.
SUMMARY STEPS
1.
(Optional) pwd
2.
(Optional) cd {filesystem:[//module/][directory] | directory}
3.findfilename-prefix
DETAILED STEPS
Command or Action
Purpose
Step 1
pwd
Example:
switch# pwd
(Optional)
Displays the name of your current default directory.
Step 2
cd {filesystem:[//module/][directory] | directory}
Example:
switch# cd bootflash:test_scripts
(Optional)
Changes the default directory.
Step 3
findfilename-prefix
Example:
switch# find bgp_script
Finds all filenames in the default directory and in its subdirectories beginning with the filename prefix. The filename prefix is case sensitive.
Working with Archive Files
The Cisco NX-OS software supports archive files. You can create an
archive file, append files to an existing archive file, extract files from an
archive file, and list the files in an archive file.
Creates an archive file and adds files to it. The filename is
alphanumeric, not case sensitive, and has a maximum length of 240 characters.
The
absolute keyword specifies that the
leading backslash characters (\) should not be removed from the names of the
files added to the archive file. By default, the leading backslash characters
are removed.
The
bz2-compress,
gz-compress, and
uncompressed keywords determine the
compression utility used when files are added, or later appended, to the
archive and the decompression utility to use when extracting the files. If you
do not specify an extension for the archive file, the defaults are as follows:
For
bz2-compress, the extension is
.tar.bz2.
For
gz-compress, the extension is
.tar.gz.
For
uncompressed, the extension is .tar.
The
remove keyword specifies that the Cisco
NX-OS software should delete the files from the filesystem after adding them to
the archive. By default, the files are not deleted.
The
verbose keyword specifies that the Cisco
NX-OS software should list the files as they are added to the archive. By
default, the files are listed as they are added.
This example shows how to create a gzip compressed archive file:
switch# tar create bootflash:config-archive gz-compress bootflash:config-file
Appending Files to an Archive File
You can append files to an existing archive file on your Cisco NX-OS
device.
Before You Begin
You have created an archive file on your Cisco NX-OS device.
tar append {bootflash: |
volatile:}archive-filename
[absolute] [remove] [verbose]
filename-list
Adds files to an existing archive file. The archive filename
is not case sensitive.
The
absolute keyword specifies that the
leading backslash characters (\) should not be removed from the names of the
files added to the archive file. By default, the leading backslash characters
are removed.
The
remove keyword specifies that the Cisco
NX-OS software should delete the files from the filesystem after adding them to
the archive. By default, the files are not deleted.
The
verbose keyword specifies that the Cisco
NX-OS software should list the files as they are added to the archive. By
default, the files are listed as they are added.
This example shows how to append a file to an existing archive file:
switch# tar append bootflash:config-archive.tar.gz bootflash:new-config
Extracting Files from an Archive File
You can extract files to an existing archive file on your Cisco NX-OS
device.
Before You Begin
You have created an archive file on your Cisco NX-OS device.
Extracts files from an existing archive file. The archive filename
is not case sensitive.
The
keep-old keyword indicates that the Cisco NX-OS
software should not overwrite files with the same name as the files being
extracted.
The
screen keyword specifies that the Cisco NX-OS
software should display the contents of the extracted files to the terminal
screen.
The
to keyword specifies the target filesystem. You
can include a directory name. The directory name is alphanumeric, case
sensitive, and has a maximum length of 240 characters.
The
verbose keyword specifies that the Cisco NX-OS
software should display the names of the files as they are extracted.
This example shows how to extract files from an existing archive file:
switch# tar extract bootflash:config-archive.tar.gz
Displaying the Filenames in an Archive File
You can display the names of the files in an archive files using the
tar list command.
tar list {bootflash: |
volatile:}archive-filename
The archive filename is not case sensitive.
switch# tar list bootflash:config-archive.tar.gz
config-file
new-config
Examples of Using the File System
This section includes example of using the file system on the Cisco NX-OS device.
This example shows how to overwrite the contents of an existing configuration in NVRAM:
switch# copy nvram:snapshot-config nvram:startup-config
Warning: this command is going to overwrite your current startup-config:
Do you wish to continue? {y/n} [y] y
You can also use the copy command to upload and download files from the slot0: or bootflash: file system to or from a FTP, TFTP, SFTP, or SCP server.
Deleting a Directory
You can remove directories from the file systems on your device.
Before You Begin
Ensure that the directory is empty before you try to delete it.
SUMMARY STEPS
1.
(Optional) pwd
2.
(Optional) dir [filesystem:[//module/][directory]]
3.rmdir [filesystem:[//module/]]directory
DETAILED STEPS
Command or Action
Purpose
Step 1
pwd
Example:
switch# pwd
(Optional)
Displays the name of your current default directory.
Step 2
dir [filesystem:[//module/][directory]]
Example:
switch# dir bootflash:test
(Optional)
Displays the contents of the current directory. The file system, module, and directory names are case sensitive.
If the directory is not empty, you must delete all the files before you can delete the directory.
Step 3
rmdir [filesystem:[//module/]]directory
Example:
switch# rmdir test
Deletes a directory. The file system and directory name are case sensitive.
Displaying File Contents
This example displays the contents of a file on an external flash
device:
switch# show file slot0:test
configure terminal
interface ethernet 1/1
no shutdown
end
show interface ethernet 1/1
This example displays the contents of a file residing in the current
directory:
switch# show file myfile
Displaying File Checksums
This example shows how to display the checksum of a file:
switch# show file bootflash:trunks2.cfg cksum
583547619
This example shows how to display the MD5 checksum of a file:
switch# show file bootflash:trunks2.cfg md5sum
3b94707198aabefcf46459de10c9281c
This example shows how to direct the output to a file on the
bootflash: file system:
switch# show interface > bootflash:switch1-intf.cfg
This example shows how to direct the output to a file on external
flash memory:
switch# show interface > slot0:switch-intf.cfg
This example shows how to direct the output to a file on a TFTP
server:
switch# show interface > tftp://10.10.1.1/home/configs/switch-intf.cfg
Preparing to copy...done
This example directs the output of the
show tech-support command to a file:
switch# show tech-support > Samplefile
Building Configuration ...
switch# dir
1525859 Jul 04 00:51:03 2003 Samplefile
Usage for volatile://
1527808 bytes used
19443712 bytes free
20971520 bytes total
Finding Files
This example shows how to find a file in the current default directory: