this post was submitted on 16 Mar 2026
11 points (100.0% liked)

Linux

13152 readers
885 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

On windows, Notepad++ compare plugin let's you compare unsaved files. So to compare two texts copied from elsewhere, just make two new tabs and paste the texts. Compare plugin will happily compare line by line.

On Linux I havent found something similar. The closes is Kate, but you still have to save tmp1.txt and tmp2.txt , and remove the clutter when finished.

Does anybody know a compare app that just lets you paste two text blocks without saving files first?

you are viewing a single comment's thread
view the rest of the comments
[–] thingsiplay@lemmy.ml 2 points 2 weeks ago* (last edited 2 weeks ago) (2 children)

I quickly wrote a script that uses kdialog from KDE to input text in a box, then writes both files to a temporary file, compares with diff and outputs the difference in a text box again. At the end it deletes the temporary files (if they are not deleted, they will be removed automatically with next system boot anyway). It's a quick and dirty script.

I call it diffuse, for diff + use.

#!/usr/env/bash

title="Diff - Compare 2 Texts"
output_size="720x720"

file1="$(mktemp)"
file2="$(mktemp)"
file3="$(mktemp)"

kdialog --title "${title} (input)" --textinputbox "Input Text 1" >> "${file2}"
kdialog --title "${title} (input)" --textinputbox "Input Text 2" >> "${file1}"
diff -- "${file1}" "${file2}" >> "${file3}"
kdialog --title "${title} (diff)" --geometry "${output_size}" --textbox "${file3}"

rm -- "${file1}"
rm -- "${file2}"
rm -- "${file3}"

Edit: Forgot to mention the name of the script.

[–] klangcola@reddthat.com 1 points 2 weeks ago

That's neat. I might just steal it (already using KDE)

[–] kibiz0r@midwest.social 1 points 2 weeks ago

You could save the output to bash vars instead of temp files and pass those in using diff <( echo $str1 ) <( echo $str2 )