> For the complete documentation index, see [llms.txt](https://heathen.gitbook.io/oscp+-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heathen.gitbook.io/oscp+-notes/misc/full-interactive-shell.md).

# Full Interactive Shell

Upgrading to a full interactive shell

1. spawn bash with python
2. backgrounding the remote shell
3. getting rows and columns
4. ignoring hotkeys in the local shell and getting back to the remote
5. setting rows and cols for remote shell
6. adding color
7. reloading bash to apply TERM variable

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

```bash
^Z
```

```bash
stty -a | head -n1 | cut -d ';' -f 2-3 | cut -b2- | sed 's/; /\n/'
```

```bash
stty raw -echo; fg
```

```bash
stty rows ROWS cols COLS
```

```bash
export TERM=xterm-256color
```

```bash
exec /bin/bash
```
