cp

cp old_name new_name

Description

Copies a file from the specified file system or relative to the current working directory to another file on the specified file system or relative to the current working directory.

Syntax Description

old_name Specifies the name of the file that you want to copy.
new_name Specifies the name of the newly copied configuration or policy file.

Default

N/A.

Usage Guidelines

Use this command to copy a file from the specified file system, or relative to the current working directory to another file on the specified file system, or relative to the current working directory. If you provide a different name, the new file can be created in the same directory as the existing file.

When you copy a configuration or policy file, remember the following:
  • XML-formatted configuration files have a .cfg file extension. The switch only runs .cfg files.
  • ASCII-formatted configuration files have a .xsf file extension. For more information, see Software Upgrade and Boot Options in the ExtremeXOS 32.1 User Guide .
  • Policy files have a .pol file extension.
  • Core dump files have a .gz file extension.

When you copy a configuration or policy file from the system, make sure you specify the appropriate file extension. For example, when you want to copy a policy file, specify the file name and .pol.

When you copy a file on the switch, the switch displays a message similar to the following:

Copy config test.cfg to config test1.cfg on switch? (y/n) 

Type y to copy the file. Type n to cancel this process and not copy the file.

When you type y, the switch copies the file with the new name and keeps a backup of the original file with the original name. After the switch copies the file, use the ls command to display a complete list of files. In this example, the switch displays the original file named test.cfg and the copied file named test_rev2.cfg.

The following is sample output from the ls command:

...
-rw-r--r--    1 root     root       100980 Sep 23 09:16 test.cfg
-rw-r--r--    1 root     root       100980 Oct 13 08:47 test_rev2.cfg
...

When you enter n, the switch displays a message similar to the following:

Copy cancelled. 

Case-sensitive Filenames

File names are case-sensitive. In this example, you have a configuration file named Test.cfg. If you attempt to copy the file with the incorrect case, for example test.cfg, the switch displays a message similar to the following:

Error: cp: /config/test.cfg: No such file or directory 

Since the switch is unable to locate test.cfg, the file is not copied.

Local File Name Character Restrictions

When specifying a local file name, the switch permits only the following characters:
  • Alphabetical letters, upper case and lower case (A-Z, a-z).
  • Numerals (0-9).
  • Period ( . ).
  • Dash ( - ).
  • Underscore ( _ ).

Internal Memory and Core Dump Files

Core dump files have a .gz file extension. The file name format is: core.process-name.pid.gz where process-name indicates the name of the process that failed and pid is the numerical identifier of that process.

By making a copy of a core dump file you can easily compare new debug information with the old file if needed.

If you have a USB 2.0 storage device installed, you can copy the core dump file to that location. To copy files to a USB device, specify the file path /usr/local/ext.

For information about configuring and sending core dump information to the internal memory card, see the configure debug core-dumps [ off | directory_path] and save debug tracefiles directory_path commands.

For more detailed information about core dump files, see Troubleshooting in the ExtremeXOS 32.1 User Guide .

Example

The following example makes a copy of a configuration file named test.cfg and gives the copied file a new name of test_rev2.cfg:

# cp test.cfg test_rev2.cfg

The following example makes a copy of a configuration file named primary.cfg on the switch and stores the copy on the removable storage device with the same name, primary.cfg:

# cp primary.cfg /usr/local/ext

The above command performs the same action as entering:

# cp primary.cfg /usr/local/ext

Or

# cp primary.cfg /usr/local/ext/primary.cfg

History

This command was first available in ExtremeXOS 11.0.

The memorycard option was added in ExtremeXOS 11.1.

The internal-memory option was added in ExtremeXOS 11.4.

Support for USB 2.0 storage devices was added in ExtremeXOS 12.5.3.

Pathname support was added in ExtremeXOS 15.5.1.

Platform Availability

This command is available on ExtremeSwitching X435, X440-G2, X450-G2, X460-G2, X465, X590, X620, and X695 series switches.