typing in two terminals at the same time

Discussion in 'Mac Programming' started by benjoshua, Nov 21, 2010.

  1. benjoshua macrumors newbie

    Nov 21, 2010
    hello everybody!
    is it possible to open two terminal's windows and after some time, be able to type in one window and it will automatically will happened in the other? it will be extremely handy for my using the diff command to test my projects...

    can anyone help?
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Not possible as described.

    Two windows is easy: choose New Window from Terminal's Shell menu.

    You can copy and paste commands into a Terminal window. You can even copy commands from one window and paste them into another. Or enter commands in any text editor (TextEdit with a Plain Text window open), then copy and paste them into Terminal windows. Or select in TextEdit and drag-n-drop to Terminal windows.

    For anything more than simple commands, I almost always edit in a text editor, then drag-n-drop or paste into a Terminal window. You can build up sets of commands quite easily, and store them in text files associated with a project. Remember to write comments with your commands so when you come back next month you know what the commands do.
  3. holmesf macrumors 6502a

    Sep 30, 2001
    Yeah, it's not really possible, not easily anyway. Each terminal window acts like its own session. Every application run by the terminal is owned by that terminal process. To get any communication you'd have to set up some inter-process communication. This could be accomplished through a socket, but using unix at this level is beyond me.
  4. BertyBoy macrumors 6502

    Feb 1, 2009
    If you explain in more detail what you want to achieve ...

    We've picked up something about running diff. Do you want to send output to the other terminal ? or run the same diff (for whatever reason) in the other terminal at the exact same time ? Or do something completely different ?
  5. jared_kipe macrumors 68030


    Dec 8, 2003
    I immediately thought of CloneKeys, but it seems it doesn't work between two windows of the same application. However if you used two different applications CloneKeys should be able to do it. Say by duplicating Terminal.app maybe.
  6. wlh99 macrumors 6502

    Feb 7, 2008
    Is it possible to redirect the output of a command to a differnt tty? Never tried it, but I would think it would work.

    Something like:

    somecommand some_arguments > /dev/tty01

    Where /dev/tty01 is the tty of the other xterm running.
  7. BertyBoy macrumors 6502

    Feb 1, 2009
    I was thinking of a variety of possibilities, from using a form of the "write" command, to using a named pipe and maybe tee.

    But let's see what the OP actually wants to achieve. Whatever, it should be do-able on real Unix, and hopefully just as easily in OS X Terminal.
  8. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    There is no distinction, OS X is UNIX...
    "POSIX-compliant, Open Brand UNIX 03 Registered Product"

    From: http://images.apple.com/macosx/technology/docs/L416017A_UNIX_TB_FF.pdf

    As for the OP... he hasn't been back to the forums since he made this post. For the last day people have been taking stabs, but it seems at this point that the suggestions need to be read and he needs to clarify what he wants if the current set of replies don't work.

  9. elppa macrumors 68040


    Nov 26, 2003
    Just to back up the previous point: given the long and complex history of Unix and given Apple have got Mac OS X 10.5 on intel and Mac OS X 10.6 officially certified as Unix, I too am curious to know what people mean when they say “real Unix”.

    And I'm not talking specifically to BertyBoy. People describe ‘Unix’ and Mac OS X as if they are different things.
  10. BertyBoy macrumors 6502

    Feb 1, 2009
    OK, 3 years late, but trying to answer your query as to what many consider "real Unix", and it should help avoid confusion in the future.

    "real Unix" is the SVR4 (or whatever release it was at when you started to use it) Unix.
    BSD Unix, which was always referred to as Unix-like, was not part of this. And I believe Mac OS is more a BSD derivative than SVR4.

    That's just the way things were when I started on "real Unix" in 1984 - same time I started on Mac, and VMS. We just never referred to our BSD machines and SunOS machines (from end 1986) as Unix.

    I'm the same today, Linux is linux, never Unix. AIX is AIX, Solaris is solaris.
  11. subsonix macrumors 68040

    Feb 2, 2008
    But to be honest unless mentioned in a historic context do you really think many refer to the actual OS once called UNIX.

    Today it's a standard maintained by the Open Group, which if met ensures Unix compatibility. By that definition AIX, Solaris and OS X are all certified Unix and systems that does not meet the standard are Unix like.

  12. northerngit macrumors member

    Jul 16, 2007

    Hopefully I've understood your requirement! You want to have multiple terminal windows open, and simply replicate input to stdin on one, to the other?

    Depending on whether you are SSH'ing to another machine, or working locally, dictates a likely solution.

    iTerm2 (http://www.iterm2.com/) - You can send keyboard input to multiple tabs

    CSSHX (https://code.google.com/p/csshx/) - csshX is a tool to allow simultaneous control of multiple SSH sessions. A master window will also be created. All keyboard input in the master will be sent to all the slave windows.

    Or the venerable Cluster SSH http://sourceforge.net/projects/clusterssh/

    Example usage instructions on combining ClusterSSH and CSSHX -


    Hope this helps!
  13. subsonix macrumors 68040

    Feb 2, 2008
    It's a 3 year old thread that was awaken from the dead today. Redirecting stdout to a tty device works as suggested previously, for diff it's possible that splitting the screen (upper right corner in Terminal) would be sufficient, but the OP never returned to explain what exactly he wanted to achieve.

Share This Page