Mohammad Reza Rezwani Asked: 2014-07-13 08:47:56 +0800 CST2014-07-13 08:47:56 +0800 CST 2014-07-13 08:47:56 +0800 CST Write command in one terminal, see result on other one 772 I want to run a command foo on one terminal and pass the result to another terminal. Is it possible to do this ? command-line 2 Answers Voted Best Answer Radu Rădeanu 2014-07-13T09:01:18+08:002014-07-13T09:01:18+08:00 Yes, it is. A picture worth a thousand words: So, you have to redirect the output of your command using > operator to /dev/pts/#. You can find # using who or w command. If tou want to redirect and the errors, use: <command> >& /dev/pts/# TuKsn 2014-07-13T09:38:42+08:002014-07-13T09:38:42+08:00 Something like this for your $HOME/.bashrc : ng() { gnome-terminal -x sh -c "$*; bash"; } This will run a command and shows the result on a new terminal window. Examples: ng ls -l ng echo foo Edit: To consider aliases from the $HOME/.bashrc use this instead: ng() { gnome-terminal -x bash -ic "$*; bash"; } then the output of ls should be colored (thanks to Radu Rădeanu for this hint).
Yes, it is. A picture worth a thousand words:
So, you have to redirect the output of your command using
>
operator to/dev/pts/#
. You can find#
usingwho
orw
command. If tou want to redirect and the errors, use:Something like this for your
$HOME/.bashrc
:This will run a command and shows the result on a new terminal window.
Examples:
Edit: To consider aliases from the
$HOME/.bashrc
use this instead:then the output of
ls
should be colored (thanks to Radu Rădeanu for this hint).