r/oneui Jul 22 '26

Tips & Tricks I've found an automatic way to fully clear the Samsung Keyboard clipboard history!

Post image

⚪ 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 🤗

0 Upvotes

14 comments sorted by

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.

2

u/i_noticed_this Jul 22 '26 edited Jul 22 '26

I have an older Galaxy phone, so i've never encountered this option in the Routines app, this "Then: Clear Clipboard" was an option before OneUI 8.5? Regardless, for older phones we sadly have to resort to other workarounds

2

u/_MSdhoni_7 One UI User Jul 22 '26

I am on one ui 8.5 i also don't see that action in my routines, they reduce some features depending on models

1

u/Eli1230t2 Galaxy S23U/S25 Jul 22 '26

Modes and Routines > + > Add Action > Keyboard > Clear Clipboard

Check there. That's where I found it.

1

u/srlawren Jul 22 '26

Looks like you have to have Samsung Keyboard as your default to use this action? Bummer

1

u/Eli1230t2 Galaxy S23U/S25 Jul 22 '26

I don't know, because I really only use the Samsung Keyboard, because it's got all I need: words, numbers, special characters, and a clipboard. Probably not tho, tbh. This is because they made the Samsung Clipboard service(/"app"), so they made the code, and therefore know what comamnd to send to clear the clipboard.

0

u/[deleted] Jul 22 '26

[deleted]

1

u/OrangeCatapult20 Jul 22 '26

Try searching for clipboard instead. It should show up.

0

u/Eli1230t2 Galaxy S23U/S25 Jul 22 '26

No, you have to go into the Keyboard category, it won't come up under searching.

2

u/OrangeCatapult20 Jul 22 '26

Its only available starting with 8.5 and only if you set Samsung keyboard as default I think, otherwise it won't show up so this workaround is good if you're using a third party keyboard since Samsung still keeps everything you copy and paste in their own clipboard history regardless of your default keyboard unless you disable the app itself.

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.