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.
dir [flash:|nvram:|bootflash:]When to Use This Command
- Verify that a new IOS image or configuration file was successfully copied to flash memory.
- Check available free space before copying a new IOS image to ensure enough room.
- List configuration files in NVRAM to confirm which startup-config or backup files exist.
- Troubleshoot boot issues by examining the bootflash directory for bootable images.
Command Examples
List files in flash memory
dir flash:Directory of flash:/ 1 -rw- 33591768 Jan 15 2025 10:30:22 +00:00 c2960-lanbasek9-mz.150-2.SE11.bin 2 -rw- 123456 Jan 15 2025 10:35:10 +00:00 config.text 3 -rw- 1234 Jan 15 2025 10:36:05 +00:00 vlan.dat 33591768 bytes total (123456 bytes free)
The output shows three files: an IOS image (c2960-lanbasek9-mz.150-2.SE11.bin), a configuration file (config.text), and a VLAN database (vlan.dat). Each line includes a file index, permissions (-rw- means readable/writable), size in bytes, date/time stamp, and filename. The last line shows total flash size and free space.
List files in NVRAM
dir nvram:Directory of nvram:/ 1 -rw- 1234 Jan 15 2025 10:40:00 +00:00 startup-config 2 -rw- 1234 Jan 15 2025 10:40:00 +00:00 private-config 32768 bytes total (30200 bytes free)
NVRAM typically contains startup-config and private-config. The output shows file sizes and free space. If startup-config is missing or empty, the router will boot to setup mode.
Understanding the Output
The dir command output lists files in the specified filesystem. Each file entry shows: index number (sequential), permissions (e.g., -rw- for read-write, drwx for directories), file size in bytes, date and time of last modification (in UTC), and filename. The last line displays total filesystem capacity and remaining free space. In a real network, you use this to verify file transfers, check available space before upgrades, and confirm the presence of critical files like IOS images and startup-config. A 'bad' value would be low free space (e.g., less than the size of a new IOS image) or missing expected files. Watch for permission changes (e.g., -r-- indicates read-only) which might indicate corruption or write-protection.
CCNA Exam Tips
Know that dir without a filesystem argument defaults to the current directory (usually flash:).
Remember that NVRAM is typically small (32KB-128KB) and used for startup-config; flash is larger and holds IOS images.
The output shows 'bytes total' and 'bytes free' — you may be asked to calculate if a new file will fit.
On some platforms, bootflash: is used instead of flash: for the internal flash; know the difference.
Common Mistakes
Forgetting to include the colon after the filesystem name (e.g., 'dir flash' instead of 'dir flash:') — this causes an error.
Assuming dir shows all filesystems; you must specify the filesystem (flash:, nvram:, bootflash:).
Misinterpreting the date/time format; it's in UTC, not local time, which can confuse troubleshooting.
Related Commands
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.
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.
show startup-config
Displays the saved configuration stored in NVRAM that loads on next device boot.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions