A C application that provides an interactive interface to manage files and directories on Cisco switches via serial connection.
- Interactive ncurses-based UI - Clean, navigable interface
- Flash directory tree view - Browse the complete flash:/ filesystem structure
- File/folder selection - Select multiple items for deletion
- Batch deletion - Delete multiple selected files and folders at once
- Binary file protection - Special confirmation for .bin, .tar, and .pkg files
- Real-time status updates - See connection and operation status
- Automatic flash initialization - Handles the switch boot sequence automatically
- Linux system
- GCC compiler
- ncurses development library
- Serial port access (USB-to-serial adapter or built-in serial port)
The easiest way to get started is using the provided Docker development environment:
# Clone the repository
git clone <repository-url>
cd cisco-cli-interface
# Build the development environment
./scripts/docker-dev.sh build
# Build the application
./scripts/docker-dev.sh debug
# Run the application
./build/cisco-cli-interface /dev/ttyUSB0The project includes a complete Docker-based development environment that handles all dependencies automatically.
Available Commands:
./scripts/docker-dev.sh build # Build the Docker environment
./scripts/docker-dev.sh shell # Start interactive development shell
./scripts/docker-dev.sh debug # Build debug version (recommended for development)
./scripts/docker-dev.sh compile # Build release version
./scripts/docker-dev.sh test # Run unit tests
./scripts/docker-dev.sh clean # Clean up Docker resourcesDevelopment Workflow:
./scripts/docker-dev.sh build- Set up the environment (first time only)./scripts/docker-dev.sh debug- Build debug version with symbols- Edit code in your IDE (changes are synced automatically)
./scripts/docker-dev.sh debug- Rebuild with changes- Test your application
The debug build includes symbols for IDE debugging and outputs to ./build/cisco-cli-interface.
If you prefer to install dependencies directly on your system:
# Install dependencies
sudo apt-get update
sudo apt-get install -y libncurses5-dev libncursesw5-dev build-essential
# Clone and build
git clone <repository-url>
cd cisco-cli-interface
make debug
# Set up serial port permissions
sudo usermod -a -G dialout $USER
# Log out and back in for changes to take effect./build/cisco-cli-interface <serial_port> [baud_rate]# Connect to USB serial adapter at default 9600 baud
./build/cisco-cli-interface /dev/ttyUSB0
# Connect to built-in serial port at 115200 baud
./build/cisco-cli-interface /dev/ttyS0 115200
# Connect to USB serial adapter at 19200 baud
./build/cisco-cli-interface /dev/ttyUSB1 19200- Connect your computer to the Cisco switch via serial cable or USB-to-serial adapter
- Run the application with the appropriate serial port
- Power on the switch and interrupt the boot sequence (usually by pressing Mode button)
- The application will automatically:
- Wait for the switch to show the flash_init prompt
- Send the flash_init command
- Wait for the switch to be ready for commands
- Arrow keys - Navigate menu options
- Enter - Select option
- q - Quit application
- Arrow keys - Navigate through files/folders
- Space - Expand/collapse directories
- r - Refresh file tree
- q - Return to main menu
- Arrow keys - Navigate through files/folders
- Space - Select/deselect items
- d - Delete selected items
- r - Refresh file tree
- q - Return to main menu
The application recognizes different file types and provides appropriate handling:
- Regular files - Standard deletion with confirmation
- Directories - Deleted only when empty (children deleted first)
- Binary files (.bin, .tar, .pkg) - Extra confirmation required due to importance
-
Check if device exists:
ls -la /dev/ttyUSB* ls -la /dev/ttyS*
-
Check permissions:
ls -la /dev/ttyUSB0
-
Add user to dialout group:
sudo usermod -a -G dialout $USER
- Wrong baud rate - Try different baud rates (9600, 19200, 38400, 57600, 115200)
- Wrong serial port - Check device manager or
dmesgfor USB device detection - Switch not ready - Ensure switch is in boot mode and showing flash_init prompt
- Missing ncurses - Install with
sudo apt-get install libncurses5-dev - Permission denied - Ensure you have write permissions in the directory
- Backup your switch configuration before using this tool if you want to preserve files on switch
- Binary files (.bin, .tar, .pkg) are critical for switch operation - be very careful when deleting these
- Test on non-production equipment first
- Ensure proper serial connection before running deletion operations
src/main.c- Main application entry point and flow controlsrc/serial.c- Serial communication functionssrc/cisco_commands.c- Cisco switch command interfacesrc/file_tree.c- File tree management and operationssrc/ui.c- ncurses-based user interfaceinclude/cisco_cli.h- Header file with all declarations
The project uses a Makefile with debug and release configurations:
make debug # Build with debug symbols (default)
make release # Build optimized release version
make clean # Remove build artifactsRun the test suite using the development environment:
./scripts/docker-dev.sh testThis project is licensed under the MIT License - see the LICENSE file for details.
This section talks about how you can contribute to the project!
This project follows a trunk-based development approach:
main- Production-ready codedevelop- Integration branch for CI/CD testing (no PRs required)- Feature branches - Branched directly from
mainusing conventional naming:feat/description- New featuresfix/description- Bug fixesrefactor/description- Code refactoringdocs/description- Documentation changestest/description- Test improvements
- Create feature branch from
main - Make changes with conventional commit messages
- Submit pull request to
main - Use
developbranch for CI/CD testing without PRs
- Fork the repository
- Create a feature branch from
main - Make your changes
- Test thoroughly
- Submit a pull request to
main
For issues and questions:
- Check the troubleshooting section
- Review the code comments
- Open an issue on the repository