C Commands

This chapter describes the basic Cisco NX-OS system commands that begin with C.

cd

To change the current working directory in the device file system, use the cd command.

cd [ filesystem :] [// server /] directory

 
Syntax Description

filesystem :

(Optional) Name of the file system. Valid values are bootflash or volatile.

// server /

(Optional) Name of the server. Valid values are ///, //module-1/, //sup-1/, //sup-active/, or //sup-local/. The double slash (//) is required.

directory

Name of the destination directory. The directory name is case sensitive.


Note There can be no spaces in the filesystem://server/directory string. Individual elements of this string are separated by colons (:) and slashes (/).


 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

Use the pwd command to verify the current working directory.

Examples

This example shows how to change the current working directory on the current file system:

switch# cd my-scripts
 

This example shows how to change the current working directory to another file system:

switch# cd volatile:
 

 
Related Commands

Command
Description

pwd

Displays the current working directory name.

clear cli history

To clear the command history, use the clear cli history command.

clear cli history

 
Syntax Description

This command has no arguments or keywords.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

Use the show cli history command to display the history of the commands that you entered at the command-line interface (CLI).

Examples

This example shows how to clear the command history:

switch# clear cli history
 

 
Related Commands

Command
Description

show cli history

Displays the command history.

clear cores

To clear the core files, use the clear cores command.

clear cores

 
Syntax Description

This command has no arguments or keywords.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

Use the show system cores command to display information about the core files.

Examples

This example shows how to clear the core file:

switch# clear cores
 

 
Related Commands

Command
Description

show system cores

Displays the core filename.

system cores

Configures the core filename.

clear debug-logfile

To clear the contents of the debug log file, use the clear debug-logfile command.

clear debug-logfile filename

 
Syntax Description

filename

Name of the debug log file to clear.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

Examples

This example shows how to clear the debug log file:

switch# clear debug-logfile syslogd_debugs
 

 
Related Commands

Command
Description

debug logfile

Configures a debug log file.

debug logging

Enables debug logging.

show debug logfile

Displays the contents of the debug log file.

clear install failure-reason

To clear the reason for software installation failures, use the clear install failure-reason command.

clear install failure-reason

 
Syntax Description

This command has no arguments or keywords.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

Examples

This example shows how to clear the reason for software installation failures:

switch# clear install failure-reason
 

 
Related Commands

Command
Description

show install all

Displays status information for the software installation.

clear license

To uninstall a license, use the clear license command.

clear license filename

 
Syntax Description

filename

Name of the license file to be uninstalled.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

Examples

This example shows how to clear a specific license:

switch# clear license fm.lic
 

 
Related Commands

Command
Description

show license

Displays license information.

clear user

To log out a particular user, use the clear user command.

clear user username

 
Syntax Description

username

Name of the user to be logged out.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

Examples

This example shows how to log out a specific user:

switch# clear user admin
 

 
Related Commands

Command
Description

show users

Displays the users currently logged on the switch.

cli var name

To define a command-line interface (CLI) variable for a terminal session, use the cli var name command. To remove the CLI variable, use the no form of this command.

cli var name variable-name variable-text

no cli var name variable-name

 
Syntax Description

variable-name

Name of the variable. The name is alphanumeric, case sensitive, and has a maximum of 31 characters.

variable-text

Variable text. The text is alphanumeric, can contain spaces, and has a maximum of 200 characters.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

You can reference a CLI variable using the following syntax:

$(variable-name)

Instances where you can use variables include the following:

  • Command scripts
  • Filenames

You cannot reference a variable in the definition of another variable.

The Cisco NX-OS software provides a predefined variable, TIMESTAMP, that you can use to insert the time of day. You cannot change or remove the TIMESTAMP CLI variable.

You cannot change the definition of a CLI variable. You must remove the variable and then create it again with the new definition.

Examples

This example shows how to define a CLI variable:

switch# cli var name testvar interface ethernet 1/3
 

This example shows how to reference a CLI variable:

switch# show $(testvar)
 

This example shows how to reference the TIMESTAMP variable:

switch# copy running-config > bootflash:run-config-$(TIMESTAMP).cnfg
 

This example shows how to remove a CLI variable:

switch# cli no var name testvar
 

 
Related Commands

Command
Description

run-script

Runs command scripts.

show cli variables

Displays the CLI variables.

clock protocol

To set the synchronization protocol for the clock to a protocol, use the clock protocol command. To remove the clock protocol, use the no form of this command.

clock protocol { none | ntp }

no clock protocol { none | ntp }

 
Syntax Description

none

Specifies that the clock can be set manually.

ntp

Specifies that the clock be set to the Network Time Protocol (NTP).

 
Command Default

None

 
Command Modes

Global configuration mode

 
Command History

Release
Modification

5.1(3)N1(1)

This command was introduced.

 
Usage Guidelines

This command does not require a license.

Examples

This example shows how to set the synchronization protocol for the clock to NTP:

switch# configure terminal
switch(config)# clock protocol ntp
switch(config)#
 

 
Related Commands

Command
Description

show running-config

Displays the running system configuration information.

 

clock set

To manually set the clock on a Cisco Nexus 5000 Series switch, use the clock set command.

clock set time day month year

 
Syntax Description

time

Time of day. The format is HH : MM : SS.

day

Day of the month. The range is from 1 to 31.

month

Month of the year. The values are January, February, March, April, May, June, July, August, September, October, November, and December.

year

Year. The range is from 2000 to 2030.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

Use this command when you cannot synchronize the switch with an outside clock source, such as an NTP server.

Examples

This example shows how to manually configure the clock:

switch# clock set 12:00:00 04 July 2008
 

 
Related Commands

Command
Description

show clock

Displays the clock time.

clock summer-time

To configure the summer-time (daylight saving time) offset, use the clock summer-time command. To revert to the default, use the no form of this command.

clock summer-time zone-name start-week start-day start-month start-time end-week end-day end-month end-time offset-minutes

no clock summer-time

 
Syntax Description

zone-name

Time zone string. The time zone string is a three-character string.

start-week

Week of the month to start the summer-time offset. The range is from 1 to 5.

start-day

Day of the month to start the summer-time offset. Valid values are Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, or Sunday.

start-month

Month to start the summer-time offset. Valid values are January, February, March, April, May, June, July, August, September, October, November, and December.

start-time

Time to start the summer-time offset. The format is HH : MM.

end-week

Week of the month to end the summer-time offset. The range is from 1 to 5.

end-day

Day of the month to end the summer-time offset. Valid values are Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, or Sunday.

end-month

Month to end the summer-time offset. Valid values are January, February, March, April, May, June, July, August, September, October, November, and December.

end-time

Time to end the summer-time offset. The format is HH : MM.

offset-minutes

Number of minutes to offset the clock. The range is from 1 to 1440.

 
Command Default

None

 
Command Modes

Global configuration mode
Interface configuration mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

Examples

This example shows how to configure the offset for summer-time or daylight saving time:

switch(config)# clock summer-time PDT 1 Sunday March 02:00 5 Sunday November 02:00 60
 

This example shows how to revert to the default offset for summer-time:

switch(config)# no clock summer-time
 

 
Related Commands

Command
Description

show clock

Displays the clock summer-time offset configuration.

clock timezone

To configure the time zone offset from Coordinated Universal Time (UTC), use the clock timezone command. To revert to the default, use the no form of this command.

clock timezone zone-name offset-hours offset-minutes

no clock timezone

 
Syntax Description

zone-name

Zone name. The name is a 3-character string for the time zone acronym (for example, PST or EST).

offset-hours

Number of hours offset from UTC. The range is from –23 to 23.

offset-minutes

Number of minutes offset from UTC. The range is from 0 to 59.

 
Command Default

None

 
Command Modes

Global configuration mode
Interface configuration mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

Use this command to offset the device clock from UTC.

Examples

This example shows how to configure the time zone offset from UTC:

switch(config)# clock timezone PST -8 0
 

This example shows how to revert the time zone offset to the default:

switch(config)# no clock timezone
 

 
Related Commands

Command
Description

show clock

Displays the clock time.

configure session

To create or modify a configuration session, use the configure session command.

configure session name

 
Syntax Description

name

Name of the session. The name is a case-sensitive, alphanumeric string up to 63 characters.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

Examples

This example shows how to create a configuration session:

switch# configure session MySession
switch(config-s)#
 

 
Related Commands

Command
Description

show configuration session

Displays information about the configuration sessions.

configure terminal

To enter configuration mode, use the configure terminal command.

configure terminal

 
Syntax Description

This command has no arguments or keywords.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

Use this command to enter configuration mode. Commands in this mode are written to the running configuration file as soon as you enter them (using the Enter key/ Carriage Return).

After you enter the configure terminal command, the system prompt changes from switch# to switch(config)#, indicating that the switch is in configuration mode. To leave configuration mode and return to EXEC mode, type end or press Ctrl-Z.

To view the changes to the configuration that you have made, use the show running-config command.

Examples

This example shows how to enter configuration mode:

switch# configure terminal
switch(config)#
 

 
Related Commands

Command
Description

copy running-config startup-config

Saves the running configuration as the startup configuration file.

end

Ends your configuration session by exiting to EXEC mode.

exit (global)

Exits from the current configuration mode to the next highest configuration mode.

show running-config

Displays the current running configuration.

copy

To copy any file from a source to a destination, use the copy command.

copy source-url destination-url

 
Syntax Description

source-url

Location URL (or variable) of the source file or directory to be copied. The source can be either local or remote, depending upon whether the file is being downloaded or uploaded.

For more information, see the “Usage Guidelines” section.

destination-url

Destination URL (or variable) of the copied file or directory. The destination can be either local or remote, depending upon whether the file is being downloaded or uploaded.

For more information, see the “Usage Guidelines” section.

 
Command Default

The default name for the destination file is the source filename.

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

5.0(2)N2(1)

Support for this command was introduced on external Universal Serial Bus (USB) Flash memory devices.

 
Usage Guidelines

The copy command allows you to copy a file (such as a system image or configuration file) from one location to another location. The source and destination for the file is specified using a Cisco NX-OS file system URL, which allows you to specify a local or remote file location. The file system being used (such as a local memory source or a remote server) determines the syntax used in the command.

You can enter on the command line all necessary source- and destination-URL information and the username to use, or you can enter the copy command and have the CLI prompt you for any missing information.

The entire copying process may take several minutes, depending on the network conditions and the size of the file, and differs from protocol to protocol and from network to network.

The colon character (:) is required after the file system URL prefix keywords (such as bootflash).

In the URL syntax for ftp:, scp:, sftp:, and tftp:, the server is either an IPv4 address or a hostname.

Format of Source and Destination URL

The format of the source and destination URLs varies according to the file or directory location. You can enter either a command-line interface (CLI) variable for a directory or a filename that follows the Cisco NX-OS file system syntax ( filesystem :[/ directory ][/ filename ]).

The following tables list URL prefix keywords by the file system type. If you do not specify a URL prefix keyword, the switch looks for a file in the current directory.

Table 1 lists URL prefix keywords for local writable storage file systems. Table 2 lists the URL prefix keywords for remote file systems. Table 3 lists the URL prefix keywords for nonwritable file systems.

 

Table 1 URL Prefix Keywords for Local Writable Storage File Systems

Keyword
Source or Destination

bootflash: [ // server / ]

Source or destination URL for boot flash memory. The server argument value is module-1, sup-1, sup-active, or sup-local.

volatile: [ // server / ]

Source or destination URL of the default internal file system. Any files or directories stored in this file system will be erased when the switch reboots. The server argument value is module-1, sup-1, sup-active, or sup-local.

 

Table 2 URL Prefix Keywords for Remote File Systems

Keyword
Source or Destination

ftp:

Source or destination URL for a FTP network server. The syntax for this alias is as follows:

ftp: [ // server][/path]/filename

scp:

Source or destination URL for a network server that supports Secure Shell (SSH) and accepts copies of files using the secure copy protocol (scp). The syntax for this alias is as follows:

scp: [ // [ username @ ] server ][ / path ] / filename

sftp:

Source or destination URL for an SSH FTP (SFTP) network server. The syntax for this alias is as follows:

sftp: [ // [ username @ ] server ][ / path ] / filename

tftp:

Source or destination URL for a TFTP network server. The syntax for this alias is as follows:

tftp: [ // server [ : port ]][ / path ] / filename

 

Table 3 URL Prefix Keywords for Special File Systems

Keyword
Source or Destination

core:

Local memory for core files. You can copy core files from the core file system.

debug:

Local memory for debug files. You can copy core files from the debug file system.

log:

Local memory for log files. You can copy log files from the log file system.

modflash:

External memory for mod files. You can copy mod files from modflash file system.

system:

Local system memory. You can copy the running configuration to or from the system file system. The system file system is optional when referencing the running-config file in a command.

usb1:

Source or destination URL for the external Universal Serial Bus (USB) Flash memory devices. You can copy the kickstart and system image to bootflash.

Note This is applicable only to the Cisco Nexus 5500 Series switches.

volatile:

Local volatile memory. You can copy files to or from the volatile file system. All files in the volatile memory are lost when the physical device reloads.

This section contains usage guidelines for the following topics:

Copying Files from a Server to Bootflash Memory

Use the copy source-url bootflash: command (for example, copy tftp: source-url bootflash:) to copy an image from a server to the local bootflash memory.

Copying a Configuration File from a Server to the Running Configuration

Use the copy { ftp: | scp: | sftp: | tftp: } source-url running-config command to download a configuration file from a network server to the running configuration of the device. The configuration is added to the running configuration as if the commands were typed in the CLI. The resulting configuration file is a combination of the previous running configuration and the downloaded configuration file. The downloaded configuration file has precedence over the previous running configuration.

You can copy either a host configuration file or a network configuration file. Accept the default value of host to copy and load a host configuration file containing commands that apply to one network server in particular. Enter network to copy and load a network configuration file that contains commands that apply to all network servers on a network.

Copying a Configuration File from a Server to the Startup Configuration

Use the copy { ftp: | scp: | sftp: | tftp: } source-url startup-config command to copy a configuration file from a network server to the switch startup configuration. These commands replace the startup configuration file with the copied configuration file.

Copying the Running or Startup Configuration on a Server

Use the copy running-config { ftp: | scp: | sftp: | tftp: } destination-url command to copy the current configuration file to a network server that uses FTP, scp, SFTP, or TFTP. Use the copy startup-config { ftp: | scp: | stfp: | tftp: } destination-url command to copy the startup configuration file to a network server.

You can use the copied configuration file copy as a backup.

Examples

This example shows how to copy a file within the same directory:

switch# copy file1 file2
 

This example shows how to copy a file to another directory:

switch# copy file1 my-scripts/file2
 

This example shows how to copy a file to another file system:

switch# copy file1 bootflash:
 

This example shows how to copy a file to another supervisor module:

switch# copy file1 bootflash://sup-1/file1.bak
 

This example shows how to copy a file from a remote server:

switch# copy scp://192.168.1.1/image-file.bin bootflash:image-file.bin
 

This example shows how to copy the kickstart and system image to bootflash:

switch# copy usb1: bootflash:
 

 
Related Commands

Command
Description

cd

Changes the current working directory.

delete

Delete a file or directory.

dir

Displays the directory contents.

move

Moves a file.

pwd

Displays the name of the current working directory.

copy running-config startup-config

To save the running configuration to the startup configuration file so that all current configuration details are available after a reboot, use the copy running-config startup-config command.

copy running-config startup-config

 
Syntax Description

This command has no arguments or keywords.

 
Command Default

None

 
Command Modes

EXEC mode

 
Command History

Release
Modification

5.0(2)N1(1)

This command was introduced.

 
Usage Guidelines

To view the changes to the configuration that you have made, use the show startup-config command.


Note Once you enter the copy running-config startup-config command, the running and the startup copies of the configuration are identical.


Examples

This example shows how to save the running configuration to the startup configuration:

switch# copy running-config startup-config
 

 
Related Commands

Command
Description

show running-config

Displays the currently running configuration.

show startup-config

Displays the startup configuration file.