cd dStabilize shell method 1
1. Spawn a tty Shell¶
via python¶
python -c 'import pty;pty.spawn("/bin/bash")'
python3 -c 'import pty;pty.spawn("/bin/bash")'
via bash¶
SHELL=/bin/bash script -q /dev/null
2. Upgrade to Interactive Shell¶
^Z background the shell with Control-Z
2.a. gather information about native terminal; note of the number of rows and columns¶
echo $TERM // xterm-256color
stty -a // rows 39; columns 77
3. allow passing of keyboard shortcuts¶
foreground the background shell¶
stty raw -echo && fg
4. reset the terminal¶
reset # reset: unknown terminal type unknown # Terminal type? xterm-256color # reset: unknown terminal type xterm-256color # Terminal type? xterm
4. set the terminal type and shell¶
export TERM=xterm
export SHELL=bash
4.a. set the rows and columns to the same as our native terminal¶
stty rows 61
stty columns 116
Stabilize shell method 2 steps to stabilize your shell 1. spawn a tty Shell via python
python3 -c 'import pty;pty.spawn("/bin/bash")'
- The export TERM=xterm command sets the terminal emulator to xterm. This will give us access to term commands such as clear.
export TERM=xterm
Finally (and most importantly) we will background the shell using
- Ctrl + Z Back in our own terminal we use
stty raw -echo; fg
This does two things: first, it turns off our own terminal echo which gives us access to tab autocompletes, the arrow keys, and Ctrl + C to kill processes
stty rows 38 columns 116