Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

ssh -t (open a pseudo tty) run commands on a remote server

Date: 2010-11-10 00:00:00 -0400

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

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.