Create a pseudo TTY with ssh -t
The -t
option in the ssh -t
command force pseudo-tty allocation.
This is very handy when you need to run remote screen based applications on the remote server, establishing something like a “temporary” ssh connection, that will be established while the command is running, and it is closed as soon as the command is finished.
Let’s suppose you want to edit a file in the remote server.
ssh -t [user]@[remote-server] vim [file]
Once you close the remote file, the ssh session will be terminated.
Another good use, is to run htop on a remote computer.
ssh -t user@10.1.1.2 htop