docs / tidy
cwm tidy
Remove duplicate commands from your history file and from the watch log.
$ cwm tidy [history|watch] [flags] How it works
tidy historykeeps the newest copy of each command. Multi-line commands count as one entry.- The history file is backed up as
<file>.cwm-<time>.bakbefore it is rewritten. - Long commands are only removed when you ask:
-cfor characters,-wfor words. The default is keep all. tidy watchremoves duplicates in the database. A command run in two folders is kept in both. The same command run twice in one folder is reduced to one.cwm tidywith no subcommand runs both.
Subcommands
- tidy history
- Tidy the shell history file on disk.
- tidy watch
- Tidy the watch log in the database.
Flags
- -c, --max-chars <n>
- Remove commands longer than n characters. 0 keeps all.
- -w, --max-words <n>
- Remove commands longer than n words. 0 keeps all.
- -y, --yes
- Skip the confirmation prompt.
Examples
Tidy the history file
$ cwm tidy history -y Shell History Analysis (File Disk)
Target File: C:/Users/you/.bash_history
• Commands: 8
• Duplicates: 2 (older copies are removed)
• Oversized Chars: Disabled (-c 0)
• Oversized Words: Disabled (-w 0)
• Optimized Result: 8 -> 6 commands
Tidied shell history file (8 -> 6 commands).
Backup: C:/Users/you/.bash_history.cwm-20261014-205028.bak
Open shells keep their own copy in memory; the change shows in new shells.Tidy the watch log
$ cwm tidy watch -y Watch History Analysis (SQLite Database)
• Total Log Entries: 3
• Path-Aware Duplicates Found: 0 (older copies are removed)
• Optimized Result: 3 -> 3 database entries
Watch history database is already clean (0 path-aware duplicates found).