[小技巧] ssh -t (open a pseudo tty) run commands on a remote server

本文转载至:http://go2linux.garron.me/linux/2010/11/ssh-t-open-pseudo-tty-run-commands-remote-server-809

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

转载说明:ssh -t 可以创建一个虚拟终端,这样就可以执行一些如 vim / htop 之类的命令,也包括 sudo 之类。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值