show flash
Displays the contents and status of the flash memory, including files, their sizes, and available space, used to verify IOS images and configuration files.
Definition: show flash is a Cisco IOS privileged exec command. Displays the contents and status of the flash memory, including files, their sizes, and available space, used to verify IOS images and configuration files.
Overview
The 'show flash' command is a fundamental diagnostic tool in Cisco IOS that displays the contents and status of the flash memory file system. Flash memory stores the IOS image, configuration files, and other system files. This command is critical for verifying which IOS image is loaded, checking available space before upgrading, and troubleshooting boot issues.
Unlike 'show version' which shows the running image, 'show flash' reveals all files present, their sizes, and the amount of free space. It is often the first step when planning an IOS upgrade or when a router fails to boot properly, as it helps confirm the presence of the expected image. The command operates in privileged EXEC mode (enable) and does not affect the running configuration.
Output is buffered and may be truncated if the flash contains many files; using 'show flash:' or 'dir flash:' provides similar information with different formatting. Understanding flash contents is essential for managing storage, ensuring sufficient space for new images, and recovering from corrupted or missing IOS files.
show flashWhen to Use This Command
- Check available flash memory before upgrading the IOS image.
- Verify that the correct IOS image is present after a download.
- Identify and delete unnecessary files to free up space.
- Confirm the file system type and total capacity of flash.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| filesystem | flash: or slot0: or usbflash0: | Specifies the filesystem to display. Default is 'flash:' on most platforms. Common values include 'flash:', 'slot0:', 'usbflash0:', or 'disk0:'. Omitting this parameter shows the default flash filesystem. Mistyping the filesystem name results in an error. |
| all-filesystems | all-filesystems | Displays information for all available flash filesystems. This is useful on platforms with multiple flash devices. Using this parameter shows a summary for each filesystem. |
| partition | partition-number | Specifies a particular partition number on the flash device. Some platforms support partitioning flash memory. If omitted, information for the entire device is shown. Using an invalid partition number returns an error. |
| detail | detail | Provides detailed information about each file, including the file system type, creation time, and permissions. This is useful for forensic analysis or when troubleshooting file corruption. Without this parameter, only basic file listing is shown. |
Command Examples
Basic show flash output
show flash-#- --length-- -----date/time------ path 1 45678912 Mar 1 2023 10:23:45 +00:00 c2960-lanbasek9-mz.150-2.SE11.bin 2 12345 Mar 1 2023 10:25:12 +00:00 config.text 3 567 Mar 1 2023 10:26:30 +00:00 vlan.dat 32456704 bytes available (45678912 bytes used)
The output lists files in flash: index number (#-), file size in bytes (--length--), timestamp (date/time), and filename (path). The last line shows total available space and used space. Here, the IOS image is the largest file, config.text is the startup config, and vlan.dat stores VLAN information.
Show flash with filesystem details
show flash:Directory of flash:/ 1 -rw- 45678912 Mar 1 2023 10:23:45 +00:00 c2960-lanbasek9-mz.150-2.SE11.bin 2 -rw- 12345 Mar 1 2023 10:25:12 +00:00 config.text 3 -rw- 567 Mar 1 2023 10:26:30 +00:00 vlan.dat 32456704 bytes total (45678912 bytes free)
Adding a colon after 'flash' shows the directory listing with file permissions (-rw- means read/write). The last line shows total flash size and free space. Note: free space is the amount available for new files.
Understanding the Output
The show flash command displays the contents of the flash memory file system. Each line represents a file with its index number, size in bytes, date and time of creation/modification, and the filename. The last line indicates total flash capacity and the amount of free space.
In a real network, you use this to ensure there is enough space for new IOS images or to verify that the correct image is present. A low free space (e.g., less than 10% of total) may indicate a need to delete old files. The presence of multiple IOS images can cause confusion during boot; typically only one should be present.
The config.text file is the startup configuration, and vlan.dat stores VLAN database information on switches. If the flash is full, you cannot copy new files, which can prevent upgrades or backups.
Configuration Scenarios
Verify IOS image before upgrade
A network engineer needs to confirm the current IOS image and available space before upgrading to a new IOS version on a Cisco 4321 router.
Topology
R1 (Cisco 4321) - standaloneSteps
- 1.Step 1: Enter privileged EXEC mode: Router> enable
- 2.Step 2: Display flash contents: Router# show flash:
- 3.Step 3: Note the current IOS image filename and size.
- 4.Step 4: Check free space to ensure enough room for new image.
- 5.Step 5: If space is insufficient, delete old files using 'delete flash:old-image.bin'.
! No configuration changes needed; verification only Router# show flash: -#-- --length-- -----date/time------ path 1 45678900 Jan 1 2025 12:00:00 isr4300-universalk9.16.12.03.SPA.bin 45678900 bytes available (45678900 bytes used)
Verify: Router# show flash: | include available Expected output shows free space, e.g., '45678900 bytes available'.
Watch out: Forgetting to check available space before copying a new image can cause the copy to fail mid-transfer, leaving a partial file that may corrupt the flash.
Troubleshoot router not booting
A router fails to boot and enters ROMmon mode. The engineer needs to check if the IOS image exists in flash.
Topology
R2 (Cisco 2901) - standalone, in ROMmonSteps
- 1.Step 1: At ROMmon prompt, initialize flash: rommon 1 > dir flash:
- 2.Step 2: If no image is found, check for backup images or configuration files.
- 3.Step 3: If image is present but corrupted, boot from TFTP or use 'boot' command with manual image path.
- 4.Step 4: If image is missing, copy a new image via TFTP or USB.
! In ROMmon mode: rommon 1 > dir flash: File size Checksum File name 45678900 0x1234 c2900-universalk9-mz.SPA.152-4.M7.bin rommon 2 > boot flash:c2900-universalk9-mz.SPA.152-4.M7.bin
Verify: After boot, 'show version' should display the expected IOS version.
Watch out: In ROMmon, the 'dir' command syntax may differ; some platforms require 'dev' or 'ls' instead of 'dir'. Always check platform documentation.
Troubleshooting with This Command
When troubleshooting flash-related issues, the 'show flash' command is indispensable. Healthy output lists files with correct sizes and a reasonable amount of free space. Problem indicators include: missing IOS image, files with size 0 (corrupted), 'bad checksum' errors, or 'file not found' when booting.
Focus on the 'bytes available' field; if it is very low or zero, the flash is full and may cause write failures. Common symptoms: router boots to ROMmon (no valid image), 'show flash' returns nothing (flash not initialized), or 'dir flash:' shows 'device not present'. Diagnostic flow: 1) Check if flash is detected: 'show flash:' or 'dir flash:'. 2) If error, reseat flash module or check hardware. 3) If flash is empty, copy a new image via TFTP or USB. 4) If image exists but boot fails, verify checksum with 'verify /md5 flash:image.bin'.
Correlate with 'show version' to see the running image, and 'show bootvar' to see the boot variable. Use 'debug flash' for real-time flash operations. On some platforms, 'show file systems' lists all available filesystems including flash.
If flash is full, delete unnecessary files with 'delete' or 'squeeze' to reclaim space. Remember that 'show flash' output is buffered; for large flash, use 'show flash | include' to filter.
CCNA Exam Tips
CCNA exam may ask which file is the IOS image; look for .bin extension.
Know that 'show flash' output shows used and free space; be able to calculate remaining space.
Remember that deleting files from flash is done with 'delete flash:filename'.
The exam might test that 'show flash' is a Privileged EXEC command, not available in User EXEC.
Common Mistakes
Confusing 'show flash' with 'show running-config' — flash shows files, not running configuration.
Assuming 'show flash' shows the current IOS version; use 'show version' for that.
Forgetting that flash memory is non-volatile; files persist after reload.
Thinking 'show flash' works in User EXEC mode; it requires Privileged EXEC.
show flash vs show version
show flash and show version are both privileged EXEC commands used for system verification, but they reveal different aspects: show flash focuses on the file system contents and storage, while show version displays the device's hardware and software identity.
| Aspect | show flash | show version |
|---|---|---|
| Scope | File system contents of flash memory | System hardware and software summary |
| Information Provided | File names, sizes, dates, free/total space | IOS version, uptime, memory, interfaces, config register |
| Typical Use | Verify IOS image presence and available storage | Confirm device identity and software compatibility |
| Persistence | Reflects flash memory state (persistent across reloads) | Reflects current running system (changes after upgrade or reload) |
| Impact | Non-disruptive, read-only | Non-disruptive, read-only |
Use show flash when you need to check available flash space, verify that an IOS image or configuration file is present, or troubleshoot file system issues.
Use show version when you need to confirm the exact IOS version, system uptime, memory allocation, or the configuration register value for compatibility or troubleshooting.
Platform Notes
On IOS-XE (e.g., Catalyst 9000 switches), the command is 'show flash:' but the output may include additional filesystem types like 'bootflash:' or 'crashinfo:'. The 'dir' command is often preferred for consistency. On NX-OS (e.g., Nexus switches), the equivalent is 'show filesystem' or 'dir bootflash:' to list files; 'show flash' is not available.
On ASA firewalls, use 'show flash:' or 'dir flash:' to view files. In IOS-XR, the command is 'dir harddisk:' or 'show filesystem'. Differences between IOS versions: In older IOS 12.x, 'show flash' shows a simple list; in 15.x and 16.x, it includes more details like file system type.
Some platforms support 'show flash: all' to show all partitions. Always verify the exact syntax for your platform using '?' or documentation.
Related Commands
dir
Lists files in the specified filesystem (flash, NVRAM, USB, bootflash). Shows file names, sizes in bytes, dates, and total/free space available.
show running-config
Displays the current active configuration in DRAM, showing all non-default settings.
show startup-config
Displays the saved configuration stored in NVRAM that loads on next device boot.
show version
Displays system hardware and software information, including IOS version, uptime, memory, interfaces, and configuration register, used to verify device identity and software compatibility.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions