Upgrading-tty-shell

To check which shell is present in the system

cat /etc/shells

bash

/bin/bash -i

sh

/bin/sh -i

python

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

Perl

perl -e 'exec "bin/bash";'

Ruby

ruby: exe "bin/bash"

Perl

perl: exec "bin/bash";

Lua

lua: os.execute('/bin/sh')

awk

awk 'BEGIN{system("/bin/sh")}'

Find

find / -name {name of file} -exec /bin/awk 'BEGIN{system("/bin/sh")}'

using Exec to launch the shell

find . -exec /bin/sh \; -quit

vim

``

vim -c ';!/bin/sh'

Vim Escape

vim
:set shell=/bin/sh
:shell

permission

ls -la <path/to/file or binary>

Stabilize Shell

Steps to Stabilize Your Shell

  1. Upgrade to an Interactive Shell

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

If python3 is unavailable, try:

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

This gives you job control and allows using built-in commands like su.

  1. Set Terminal Type

export TERM=xterm

This ensures compatibility with commands like clear and vim.

  1. Background the Shell Press:

Ctrl + Z

This suspends the session and returns control to your local shell.

  1. Modify Terminal Settings on Your Local Machine

stty raw -echo; fg
  • stty raw -echo disables local echo and allows features like Tab autocompletion, arrow keys, and Ctrl + C.

  • fg brings the background shell back to the foreground.

  1. Adjust Terminal Size (Optional)

stty rows 38 columns 116

This ensures proper formatting for commands like vim or less. Bonus: Enable a Full TTY Shell If the above steps arenโ€™t enough, try:

script /dev/null -c bash

or

reset

This may further improve terminal capabilities.

Last updated