clean - Clean Environment
Reset your local environment to a clean state by removing all downloaded files, configurations, and cached data.
Purpose
The clean command provides a complete reset of your local development environment, removing all downloaded shop files, database dumps, configuration files, and cached data to start fresh.
When to Use
- Troubleshooting persistent issues: When environment problems can’t be resolved otherwise
- Starting fresh with a project: Clean slate for a project you want to reconfigure
- Freeing up disk space: Remove all local files when project is no longer needed
- Project switching: Complete cleanup before setting up a different project
- Corrupted environment: When local files or configuration become corrupted
Usage
Interactive Clean (with confirmation)
Force Clean (no prompts)
# Skip confirmation prompts
ps-enterprise clean --force
Options
| Flag |
Short |
Description |
Required |
--force |
-f |
Skip confirmation prompts and clean without asking |
No |
--help |
-h |
Show command help |
No |
⚠️ What Gets Removed
The clean command removes everything related to your local environment:
Local Environment Files
- Shop Files: All downloaded PrestaShop shop files and directories
- Vendor Dependencies: Composer dependencies and node_modules
- Cache Files: Application cache, logs, and temporary files
- Generated Files: Auto-generated configuration and cache files
Database Files
- Database Dumps: All downloaded database dump files (
tmp/dump.sql)
- Local Database Data: Docker volume data (if containers are stopped)
- Database Backups: Any local database backup files
Configuration Files
- CLI Configuration:
.ps-enterprise/config.json and related files
- Environment Settings: Local environment configuration
- Authentication Data: Stored authentication tokens and credentials
Docker Resources
- Containers: All project-related Docker containers
- Networks: Project-specific Docker networks
- Volumes: Project data volumes (database, uploads, etc.)
- Images: Optionally removes project-specific Docker images
⚠️ What Gets Preserved
The following items are NOT removed:
System-Level Resources
- Docker Installation: Docker Desktop/Engine remains installed
- Global Docker Images: Shared Docker images used by multiple projects
- SSH Keys: Your SSH keys remain in
~/.ssh/
- Global Git Configuration: Git user configuration and global settings
Other Projects
- Other Directories: Files and configurations in other project directories
- Global Tools: System-wide installed tools and applications
Safety Considerations
⚠️ Data Loss Warning
The clean command causes permanent data loss:
- No Undo: Cleaned files cannot be recovered
- Local Changes: Any local modifications are permanently lost
- Database Data: Local database changes are lost
- Uploaded Files: Test uploads and media files are removed
Before Cleaning
- Backup Important Changes: Save any local modifications you want to keep
- Export Database Changes: Export any database changes you’ve made locally
- Document Configuration: Note any custom configuration you want to recreate
- Commit Code: Commit any code changes to version control
Troubleshooting
Permission Errors
❌ Permission denied: Cannot remove /path/to/file
Solution:
- Check file ownership:
ls -la
- Fix permissions:
chmod -R 755 . or sudo chown -R $USER:$USER .
- Retry clean operation
Incomplete Cleanup
⚠️ Some files could not be removed
Solution:
- Check for remaining files:
ls -la
- Manual cleanup:
rm -rf .ps-enterprise/ tmp/ var/cache/
- Check Docker resources:
docker system prune
Integration with Other Commands
Typical Cleanup and Restart Workflow
# Complete environment reset
ps-enterprise clean --force
# Fresh setup
ps-enterprise auth
ps-enterprise config
ps-enterprise clone
ps-enterprise remote-dump
ps-enterprise patch
ps-enterprise start
Project Migration
# Old project cleanup
cd old-project
ps-enterprise clean --force
# New project setup
mkdir new-project && cd new-project
ps-enterprise # Complete setup
The clean command resets the environment, requiring complete setup afterward:
auth - Required after cleaning (removes authentication)
config - Required after cleaning (removes configuration)
clone - Required after cleaning (removes shop files)
remote-dump - Required after cleaning (removes database dump)
WARNING: This command permanently deletes ALL local files, database dumps, configuration, and Docker data. This action cannot be undone. Always backup important local changes before cleaning.
Disk Space: The clean command can recover significant disk space - from hundreds of megabytes to several gigabytes depending on your project size and accumulated data.
Fresh Start: Use clean when you want to guarantee a completely fresh environment, especially useful for troubleshooting persistent issues.