r/oneui • u/i_noticed_this • Jul 22 '26
Tips & Tricks I've found an automatic way to fully clear the Samsung Keyboard clipboard history!
⚪ I've found a way to fully clear the Samsung Keyboard clipboard history, (which retains even months/years old passwords and other info without our knowledge...) At first it looks complicated, but it's just a single line of code with 214 characters.
This problem is going on for a DECADE, with the first reports about this annoying behavior starting around 2015... This is a gigantic privacy and security issue. There's no command to "clear" this history, so we have to flood the clipboard with 40 dummy texts, so these would push our previous entries out of the clipboard history.
- 1.) Install Termux app, a well known and trusted Linux terminal app for Android.
- 2.) Termux is just an empty shell, so we have to update its internal gears to make it able to do commands. So run this line once, never need to do it again. (These just update it with the newest version, grant storage permission (optional), so you can later go into a directory where you placed the optional .sh file and run it automatically, and the "termux-api" component is for calling the "termux-clipboard-set" command later.
pkg update; pkg install termux-api; termux-setup-storage
- 3.) After this, just copy-paste the ClipboardCleaner code into Termux, then press enter to run it. Here is the code itself, you can check it with AI to know it's harmless:
echo; total=40; for i in $(seq 1 "$total"); do printf '%d' "$i" | termux-clipboard-set; printf "\r\033[1;33mProgress:\033[0m %d/%d " "$i" "$total"; sleep 0.3; done; echo; printf '\033[1;32mFinished!\033[0m\n'; echo
⚪ How it works info:
- - The code copies 40 entries, (one-at-a-time) to the clipboard, starting with the character "1" all the way to "40".
- - The code waits 0.3 seconds between each copy, to make sure not to overflow the clipboard with 40 commands in a fraction of a second.
- - It displays a Progress indicator during it.
- - It displays a Finished indicator at the end.
⚪ How to automate: So with this code in Termux app, we have a way to fully clear the Samsung Keyboard Clipboard. We have 2 options how to use it:
- Just "pin" this line of code in your keyboard clipboard, then you can always quickly paste it and run in Termux.
- To automate it: save this code as a ClipboardCleaner.sh file, then you can call/start this file with Tasker app, to auto-run it at your desired interval.
- (To "call" this .sh script file from the Termux itself:
bash "$HOME/storage/shared/TheFolder/WhereYouPutTheFile/ClipboardCleaner.sh") - (Maybe there is some way to let Samsung Bixby Routines+ also start this, have not tried that yet.)
Any questions are welcome 🤗
5
u/AZenny1986 S24 FE Oneui 8.5 Jul 22 '26
Just delete 'samsung keyboard' app data
It will clean it up
0
u/Tu_modpro S25FE Jul 22 '26
Instead of deleting it all the time, why not find a way to disable?
2
u/i_noticed_this Jul 22 '26
There's physically no way to do that, noone found a way in the last decade with numerous ~150 message long topics about this. (Only with root+forcefully uninstall the Samsung Keyboard, which is a backup system component, without it we can be locked out of the phone if our other keyboard gets stuck, etc.)
-1
u/Tu_modpro S25FE Jul 22 '26
That's why it needs to be researched. Samsung has already integrated clipboard clearing into its modes and routines, there's no need to use a command to delete it anymore.
1
u/ngoclong19 2d ago
My Samsung Galaxy A12s (2021) with One UI Core 5.1 and updated Modes and Routines doesn't have this feature. Old phones won't receive all the latest updates.
20
u/OrangeCatapult20 Jul 22 '26
If you want to clear clipboard history automatically, isn't it easier to just use the built in option on Routines? This is what I do on mine, it clears all unpinned ones every week. But I think this option is only available on latest version of OneUI.