I can hide what is written in a terminal with bash with
This is however not working for zsh: running this command does not change the output of
What is the equivalent command of
stty -echo for zsh?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
zsh resets the terminal when returning to the prompt. Which is actually really useful since it prevents you from getting stuck in the prompt with a broken terminal and having to cast strange incantations to restore sanity.
According to a mailing list discussion, you can make it not do that at the expense of disabling line editing completely with
By default, the terminal configuration associated with the current session is frozen, so most settings done with
stty are ephemeral.
According to zsh documentation, you can unfroze your terminal with this command
and revert to the regular, frozen mode with:
In unfrozen mode, your
stty settings are supposed to persist. It doesn't seems to be the case with
However, if your goal is to temporarily disable echoing characters for a single command or an external program, the default behavior might be sufficient:
$ stty -echo;stty -a;read foo speed 38400 baud; rows 44; columns 165; line = 0; intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke $ echo $foo abc
stty reports the
-echo setting and the characters typed in reply to the
read command weren't echo'ed to the screen.