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

Linux

12841 readers
1118 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?

top 12 comments
sorted by: hot top controversial new old
[–] unexpectedprism@programming.dev 11 points 20 hours ago (1 children)

meld allows you to start an empty comparison and to paste content into it without saving.

[–] bobby@lemmy.dbzer0.com 1 points 20 hours ago

meld is pretty cool, yes.

[–] frongt@lemmy.zip 9 points 1 day ago* (last edited 23 hours ago)

diff(1)

Edit: oh I'm not sure you can paste two things into the terminal like that. Maybe kdiff3. If I'm really lazy I use this online one: https://editor.mergely.com/

[–] dihutenosa@piefed.social 5 points 23 hours ago
diff <<EOF  
pastestuffhere  
EOF  

while this is running, paste the other stuff into terminal. I'm assuming diff reads stdin, if not given a filename.

[–] dgdft@lemmy.world 5 points 1 day ago

You could always run NP++ via WINE if you can't find a native Linux solution that you like.

[–] dihutenosa@piefed.social 3 points 1 day ago* (last edited 1 day ago)

vim's :diffthis

[–] thingsiplay@lemmy.ml 2 points 22 hours ago* (last edited 22 hours ago) (1 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/bin/env bash

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

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

kdialog --title "${title} (input)" --textinputbox "Input Text 1" >> "${file1}"
kdialog --title "${title} (input)" --textinputbox "Input Text 2" >> "${file2}"
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. Edit2: Totally wrong shebang line corrected.

[–] kibiz0r@midwest.social 1 points 22 hours ago (1 children)

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

[–] thingsiplay@lemmy.ml 1 points 22 hours ago

I would want to avoid echo and just write to output file directly.

[–] jack@lemmy.sdf.org 1 points 22 hours ago

For CLI, diff has already been mentioned; for a GUI application I'd recommend meld:

https://meldmerge.org/

[–] Jestzer@lemmy.world 1 points 23 hours ago

It’s not a very Linux-y answer, but VSC does allow you to compare 2 pages for differences. Those pages can be unsaved or saved files.