4 ms·
I guess the most important message isn't even "don't paste things into the terminal". It's "don't use a terminal that pastes things automatically, or by some ac
by marcosdumay 6y ago
I guess the most important message isn't even "don't paste things into the terminal". It's "don't use a terminal that pastes things automatically, or by some action you will do by mistake".
Or, more specifically, don't ever use the default behavior of putty in a laptop with a trackpad and a gesture enabled for left click. If you use putty, set copy and paste to something less random.
- stelliosk 6y agoAlways enable the option 'confirm paste' if available in an terminal emulator.
- pcl 6y agoiTerm has great behavior here — it allows painless pasting of things without newlines, but prompts for pasteboard contents that contain newlines.
- scaladev 6y agoWhen pasting something to the terminal (especially if it's longer than one line or was copied from an untrusted source), I like this approach: 1. open your terminal emulator; 2. press Ctrl-X + Ctrl-E in a shell prompt; 3. it opens your $EDITOR, paste the command there, check it for anything unusual, then save and exit; 4. the shell runs whatever was in that script you saved.
- kzrdude 6y agoNice, thanks, learned something :) Tip for Vi/Vim users: to exit without having the command run, exit the editor with failure; the command for that is is :cq in Vim. (Also works fine in git to cancel commits etc.)
- marcosdumay 6y agoAdding for emacs users, the kill-emacs command does the same. I don't think it has a shortcut by default, so it's M-x kill-emacs.