1. Most of the times very similar to upgrade interactive shell.
  2. Usually just need to try python way of upgrading:
    python3 -c 'import pty; pty.spawn("/bin/bash")'
  3. Check what is on PATH, echo $PATH. If the path is in your current folder, just ls foldername (no need to use /). Check GTFObin and see if you can shell with any of the file inside.
  4. If not refer to this page: https://null-byte.wonderhowto.com/how-to/escape-restricted-shell-environments-linux-0341685/