SystemPrivileged EXEC

delete [file]

Deletes a file from the device's flash memory or other storage, used to remove unwanted configuration files, IOS images, or other stored data.

Syntax·Privileged EXEC
delete [file]

When to Use This Command

  • Remove an old IOS image to free up space before upgrading to a new version.
  • Delete a backup configuration file that is no longer needed.
  • Clean up temporary files or core dumps from flash memory.
  • Remove a corrupted file that prevents the device from booting properly.

Command Examples

Delete a specific file from flash

delete flash:old-config.cfg
Delete filename [old-config.cfg]? 

The command prompts for confirmation before deletion. Typing 'yes' or pressing Enter (if default is yes) will delete the file. No output is shown after successful deletion.

Delete a file with forced confirmation

delete /force flash:unwanted-image.bin

The /force option suppresses the confirmation prompt. The file is deleted immediately with no output. Use with caution.

Understanding the Output

The delete command typically produces no output upon success, or only a confirmation prompt. If the file does not exist, an error like '%Error deleting flash:file (No such file)' appears. If the file is in use (e.g., boot image), the deletion may fail with '%Error deleting flash:file (File in use)'. Always verify with 'dir' after deletion.

CCNA Exam Tips

1.

Remember that the delete command requires the full file path (e.g., flash:filename).

2.

The /force option is useful in scripts but dangerous in exams—know when it's appropriate.

3.

Deleting the running-config file is not possible; use 'erase startup-config' instead.

4.

CCNA may test the difference between 'delete' and 'erase' (erase is for startup-config or entire flash).

Common Mistakes

Forgetting to specify the file system (e.g., flash:) leading to 'Invalid input detected'.

Deleting the active IOS image, causing the device to fail to boot until a new image is loaded via TFTP/Xmodem.

Not verifying free space before deletion, leading to accidental deletion of important files.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions