4 ms·
When 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 ter
by scaladev 6y ago
When 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.