Stabilizing zsh shell

First you will need to spawn a TTY shell. This can be either done with the scripts command or using the python command.

Using the scripts command:

script -qfc /bin/bash /dev/null

Using Python:

python -c 'import pty; pty.spawn("/bin/bash")'

Using Python 3:

python3 -c 'import pty; pty.spawn("/bin/bash")'

After spawning a TTY shell, you can stabilize the shell to enable tab auto-complete and no accidental CRTL+c that will terminate your shell.

Firstly, background your shell with the following keyboard command:

ctrl + z

Then paste into your terminal the following (This will also foreground your shell again):

stty -a | head -n1 | cut -d ';' -f 2-3 | cut -b2- | sed 's/; /\n/'
stty raw -echo; fg
stty rows ROWS cols COLS

And finally paste in the following command in your terminal:

export TERM=xterm-256color
exec /bin/bash
reset

Last updated