The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This chapter describes how to use the files systems on the Cisco NX-OS device.
This chapter includes the following sections:
This section describes file systems, directories, and files on the Cisco NX-OS device.
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. |
|
volatile |
— | Volatile random-access memory (VRAM) located on a supervisor module used for temporary or pending changes. |
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. |
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.
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 also download files, such as system image files, from remote servers using FTP, Secure Copy (SCP), Secure Shell FTP (SFTP), and TFTP.
The following table shows the licensing requirements for this feature:
Product |
License Requirement |
---|---|
Cisco NX-OS |
Using the file systems, directories, and files requires no license. Any feature not included in a license package is bundled with the Cisco NX-OS system images and is provided at no extra charge to you. For a complete explanation of the Cisco NX-OS licensing scheme, see the Cisco NX-OS Licensing Guide. |
This section describes how to work with directories on the Cisco NX-OS device.
You can display the directory name of your current directory.
1. pwd
Command or Action | Purpose | |
---|---|---|
Step 1 | pwd Example: switch# pwd |
Displays the name of your current directory. |
You can change the current directory for file system operations. The initial default directory is bootflash:.
1. (Optional) pwd
2. cd {directory | filesystem:[//module/][directory]}
You can create directories in the bootflash: and flash device file systems.
1. (Optional) pwd
2. (Optional) cd {directory | filesystem:[//module/][directory]}
3. mkdir [filesystem:[//module/]]directory
You can display the contents of a directory.
1. dir [directory | filesystem:[//module/][directory]]
You can remove directories from the file systems on your device.
Ensure that the directory is empty before you try to delete it.
1. (Optional) pwd
2. (Optional) dir [filesystem :[//module/][directory]]
3. rmdir [filesystem :[//module/]]directory
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/.
This section describes how to work with files on the Cisco NX-OS device.
You can move a file from one directory to another directory.
Caution |
If a file with the same name already exists in the destination directory, that file is overwritten by the moved file. |
You can use the move command to rename a file by moving the file within the same directory.
1. (Optional) pwd
2. (Optional) dir [filesystem:[//module/][directory]]
3. move [filesystem:[//module/][directory /] | directory/]source-filename {{filesystem:[//module/][directory /] | directory/}[target-filename] | target-filename}
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. |
1. (Optional) pwd
2. (Optional) dir [filesystem:[//module/][directory]]
3. copy [filesystem:[//module/][directory/] | directory/]source-filename | {filesystem:[//module/][directory/]] | directory/}[target-filename]
You can delete a file from a directory.
1. (Optional) dir [filesystem:[//module/][directory]]
2. delete {filesystem:[//module/][directory/] | directory/}filename
You can display the contents of a file.
1. show file [filesystem:[//module/]][directory/]filename
Command or Action | Purpose | |
---|---|---|
Step 1 | show file [filesystem:[//module/]][directory/]filename Example: switch# show file bootflash:test-results |
Displays the file contents. |
You can display checksums to check the file integrity.
1. show file [filesystem:[//module/]][directory/]filename {cksum | md5sum}
Command or Action | Purpose | |
---|---|---|
Step 1 | show file [filesystem:[//module/]][directory/]filename {cksum | md5sum} Example: switch# show file bootflash:trunks2.cfg cksum |
Displays the checksum or MD5 checksum of the file. |
You can compress and uncompress files on your Cisco NX-OS device using Lempel-Ziv 1977 (LZ77) coding.
1. (Optional) dir [filesystem:[//module/]directory]]
2. gzip [filesystem:[//module/][directory/] | directory/]filename
3. gunzip [filesystem:[//module/][directory/] | directory/]filename .gz
Command or Action | Purpose | |
---|---|---|
Step 1 | dir [filesystem:[//module/]directory]] Example: switch# dir bootflash: |
(Optional) Displays the contents of the current directory. The file system and directory name are case sensitive. |
Step 2 | gzip [filesystem:[//module/][directory/] | directory/]filename Example: switch# gzip show_tech |
Compresses a file. After the file is compressed, it has a .gz suffix. |
Step 3 | gunzip [filesystem:[//module/][directory/] | directory/]filename .gz Example: switch# gunzip show_tech.gz |
Uncompresses a file. The file to uncompress must have the .gz suffix. After the file is uncompressed, it does not have the .gz suffix. |
You can display the last lines of a file.
1. tail [filesystem:[//module/]][directory/]filename [lines]
Command or Action | Purpose | |
---|---|---|
Step 1 | tail [filesystem:[//module/]][directory/]filename [lines] Example: switch# tail ospf-gr.conf |
Displays the last lines of a file. The default number of lines is 10. The range is from 0 to 80 lines. |
You can redirect show command output to a file on bootflash:, slot0:, volatile:, or on a remote server.
1. show-command > [filesystem:[//module/][directory] | [directory /]]filename
Command or Action | Purpose | |
---|---|---|
Step 1 | show-command > [filesystem:[//module/][directory] | [directory /]]filename Example: switch# show tech-support > bootflash:techinfo |
Redirects the output from a show command to a file. |
You can find the files in the current working directory and its subdirectories that have names that begin with a specific character string.
1. (Optional) pwd
2. (Optional) cd {filesystem:[//module/][directory] | directory}
3. find filename-prefix
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 | find filename-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. |
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.
You can create an archive file and add files to it. You can specify the following compression types:
The default is gzip.
1. tar create {bootflash: | volatile:}archive-filename [absolute] [bz2-compress] [gz-compress] [remove] [uncompressed] [verbose] filename-list
Command or Action | Purpose | |
---|---|---|
Step 1 | tar create {bootflash: | volatile:}archive-filename [absolute] [bz2-compress] [gz-compress] [remove] [uncompressed] [verbose] filename-list |
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:
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
You can append files to an existing archive file on your Cisco NX-OS device.
You have created an archive file on your Cisco NX-OS device.
1. tar append {bootflash: | volatile:}archive-filename [absolute] [remove] [verbose] filename-list
Command or Action | Purpose | |
---|---|---|
Step 1 | 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
You can extract files to an existing archive file on your Cisco NX-OS device.
You have created an archive file on your Cisco NX-OS device.
1. tar extract {bootflash: | volatile:}archive-filename [keep-old] [screen] [to {bootflash: | volatile:}[/directory-name]] [verbose]
Command or Action | Purpose | |
---|---|---|
Step 1 | tar extract {bootflash: | volatile:}archive-filename [keep-old] [screen] [to {bootflash: | volatile:}[/directory-name]] [verbose] |
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
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
This section includes example of using the file system on the Cisco NX-OS device.
This example shows how to list the files on the standby supervisor module:
switch# dir bootflash://sup-remote 12198912 Aug 27 16:29:18 2003 m9500-sf1ek9-kickstart-mzg.1.3.0.39a.bin 1864931 Apr 29 12:41:59 2003 dplug2 12288 Apr 18 20:23:11 2003 lost+found/ 12097024 Nov 21 16:34:18 2003 m9500-sf1ek9-kickstart-mz.1.3.1.1.bin 41574014 Nov 21 16:34:47 2003 m9500-sf1ek9-mz.1.3.1.1.bin Usage for bootflash://sup-remote 67747169 bytes used 116812447 bytes free 184559616 bytes total
This example shows how to delete a file on the standby supervisor module:
switch# delete bootflash://sup-remote/aOldConfig.txt
This example shows how to move a file on an external flash device:
switch# move slot0:samplefile slot0:mystorage/samplefile
This example shows how to move a file in the default file system:
switch# move samplefile mystorage/samplefile
This example shows how to copy the file called samplefile from the root directory of the slot0: file system to the mystorage directory:
switch# copy slot0:samplefile slot0:mystorage/samplefile
This example shows how to copy a file from the current directory level:
switch# copy samplefile mystorage/samplefile
This example shows how to copy a file from the active supervisor module bootflash to the standby supervisor module bootflash:
switch# copy bootflash:system_image bootflash://sup-2/system_image
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.
You can remove directories from the file systems on your device.
Ensure that the directory is empty before you try to delete it.
1. (Optional) pwd
2. (Optional) dir [filesystem :[//module/][directory]]
3. rmdir [filesystem :[//module/]]directory
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. |
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
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 compress a file:
switch# dir 1525859 Jul 04 00:51:03 2003 Samplefile ... switch# gzip volatile:Samplefile switch# dir 266069 Jul 04 00:51:03 2003 Samplefile.gz ...
This example shows how to uncompress a compressed file:
switch# dir 266069 Jul 04 00:51:03 2003 Samplefile.gz ... switch# gunzip samplefile switch# dir 1525859 Jul 04 00:51:03 2003 Samplefile ...
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
This example shows how to find a file in the current default directory:
switch# find smm_shm.cfg /usr/bin/find: ./lost+found: Permission denied ./smm_shm.cfg ./newer-fs/isan/etc/routing-sw/smm_shm.cfg ./newer-fs/isan/etc/smm_shm.cfg
Parameters |
Default |
---|---|
Default filesystem |
bootflash: |
This section includes additional information related to the file systems.
Related Topic |
Document Title |
---|---|
Licensing |
Cisco NX-OS Licensing Guide |
Command reference |
Cisco Nexus 3000 Series NX-OS Command Reference |