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.
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.cfgDelete 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.binThe /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
Remember that the delete command requires the full file path (e.g., flash:filename).
The /force option is useful in scripts but dangerous in exams—know when it's appropriate.
Deleting the running-config file is not possible; use 'erase startup-config' instead.
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
dir [flash:|nvram:|bootflash:]
Lists the contents of a specified file system (flash, nvram, or bootflash) on a Cisco IOS device, showing file names, sizes, dates, and available space.
show file systems
Displays a list of all file systems available on the Cisco IOS device, including their type, permissions, and usage statistics, used for verifying storage availability and managing files.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions