brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Windows Terminal warns before large or multi-line pastes

Terminal
~/tips/tip-windows-terminal-paste-warnings

"multiLinePasteWarning": true,

Two Windows Terminal settings control the paste warnings, and they are on by default.

Pasting a command from a website into a shell is a small gamble: a newline in the text runs it before you have read it. Windows Terminal has a guard for that.

"multiLinePasteWarning": true,
"largePasteWarning": true

Both go at the root of settings.json and both default to true. The documentation says multiLinePasteWarning shows a dialog when you paste text with multiple lines, because in most shells one line is one command, so pasting a newline can run commands without you validating them. It suggests this is useful if you often copy and paste commands from untrusted websites.

largePasteWarning asks before pasting more than 5 KiB of characters. The doc mentions an accidental right-click after selecting a lot of text, which would otherwise make the terminal unresponsive while the program receives the clipboard.

A neighbouring setting is trimPaste. It trims trailing whitespace when pasting, defaults to true and accepts true or false.

If the dialogs annoy you, setting a value to false pastes right away. I’d keep the multi-line one on. Pasting into a shell is the one place where reading before running is worth a click.

The caveat is that the dialog only helps if you read the text in it. It does not judge the command, it only stops it for a moment.

None of this was run on a live Windows machine here. It follows the Microsoft documentation.

Further reading: Windows Terminal interaction settings

More Terminal tips "copyOnSelect": true script -qc 'ls --color=auto -d .' /dev/null | cat -v tput civis ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group All Terminal tips (124) All topics

Link