A surprising twist of the CLI copy command
Normally, the generic CLI copy command copies local and remote files. Typically, you give the copy command the source path and the destination path. Either the source or the destination path (but not both) can be on a remote machine. The local paths are relative to the CLI root.
copy /cliscripts/just-saved.cli /cliscripts/some-more-meaningful-name.cli copy /configs/backup sftp://[email protected]/path/to/saved/backups copy sftp://[email protected]/path/to/downloaded/upgrade/file.tgz /loads
However, the copy command can do something you may not be aware of – it also doubles as a configuration backup command!
When the source file is given as "current-config", it will NOT copy a file called "current-config" to the destination. In this one case, it will generate a backup and put it at the specified destination.
copy current-config sftp://[email protected]/path/to/saved/backups/current-config.backup
Note that this backup is different from the file that is obtained with the following command:
show current-config all > /cliscripts/current-config.all
The copy-generated current-config is a tgz of a few files.
The file generated with the
show current-config all command is a text file with CLI commands required to bring a fresh machine to the current configuration.
One caveat: If you want to move a file from /current-config (rooted at the CLI root), you will have to give the full path (including the / at the beginning) as the source name. Otherwise, a new zipped tar archive will be generated and placed at the destination.