Posts Spawning TTYs
Post
Cancel

Spawning TTYs

Configuration


After executing the commands to spawn a TTY shell I tend to run the following (allows you to clear the terminal output):

1
$ export TERM=xterm-color

Spawn TTY


The following commands should be executed from the Linux command line. What TTY you’re able to spawn will come down to available shells on the host - cat /etc/shells

Python

1
2
3
4
5
python -c 'import pty; pty.spawn("/bin/bash")'
python -c 'import pty; pty.spawn("/bin/sh")'

echo os.system('/bin/bash')
echo os.system('/bin/sh')


Interactive shells

1
2
/bin/bash -i
/bin/sh -i


Perl

1
2
perl  -e 'exec "/bin/bash";'
perl  -e 'exec "/bin/sh";'


Ruby

1
2
exec "/bin/bash"
exec "/bin/sh"


Lua

1
2
os.execute('/bin/bash')
os.execute('/bin/sh')


Vim

1
2
3
// From within vim
:!bash
:set shell=/bin/bash:shell
This post is licensed under CC BY 4.0 by the author.