Kann ich beim Start von Terminal eine Reihe von Registerkarten einrichten?

975
Ethan

Jeden Morgen starte ich das OS X-App-Terminal und setze mühsam eine Reihe von Registerkarten auf ...

  • Eine SSH-Sitzung zu einem bestimmten Server ( $ ssh ...)
  • Eine Skript- / Konsolensitzung für die Rails-App, an der ich gerade arbeite ( $ cd myapp ; script/console)
  • Eine Autotest-Sitzung ( $ cd myapp ; autotest)

Und noch ein paar andere.

Gibt es eine Möglichkeit, die Tabs und Sitzungen automatisch zu starten, wenn ich Terminal starte?

(Ich kann die Maschine nicht einfach laufen lassen, weil es ein Laptop ist und ich es hier und da herumtrage.)

6

2 Antworten auf die Frage

10
jtb

Gehen Sie zu den Voreinstellungen des Terminals und legen Sie für jede gewünschte Registerkarte Terminaleinstellungen an. Sie sehen bereits eine Reihe von Standardkonfigurationen (Grundausstattung, Gras usw.). Ändern Sie diese oder erstellen Sie Ihre eigenen, um die gewünschten Farben für die einzelnen Registerkarten / Fenster festzulegen. Gehen Sie dann zur Shell-Registerkarte und füllen Sie das Befehlsfeld Ausführen mit dem ssh ...gewünschten Befehl aus.

Öffnen Sie dann die Registerkarten und ordnen Sie sie so an, wie Sie sie beim Start haben möchten. Gehen Sie dann zu Fenster >> Windows als Gruppe speichern und aktivieren Sie das Kontrollkästchen, um sie beim Start von Terminal zu verwenden.

Viel bessere Antwort als meine. Jack M. vor 14 Jahren 0
1
Chris Page

As of Mac OS X Lion 10.7, Terminal makes this a little simpler:

If you create a terminal with Shell > New Command or Shell > New Remote Connection, then create a Window Group, there's a new checkbox to tell it to "restore all commands" as well. So you no longer have to customize settings profiles just to specify a command to run.

(These menu items always create windows. You can View > Show Tab Bar if necessary, then drag them together to arrange them as tabs in the same window.)

In fact, it will automatically restore (re-run) a small set of common "safe"† commands: anything listed in /etc/shells, screen, tmux, emacs, vi/vim, nano, pico, top, and sessions created with New Remote Connection (ssh, etc.).

Moreover, Terminal supports Lion's Resume: It will automatically restore open windows (including "safe" commands) if you quit and restart Terminal, without having to create a Window Group. (To get Resume to restore other commands, use custom settings profiles to specify commands, as mentioned in jtb's answer.)

† With the exception of top, the individual commands I listed are only considered safe when run without arguments. The others each have arguments that could be destructive or surprising to users if run without user confirmation. The set of "safe" commands can be customized with defaults write com.apple.Terminal RestorableCommands -array ... by setting the preference to an array of strings. To specify that it's safe to run a command with arguments, include an asterisk where arguments would be. The default value for this preference is: "screen", "tmux", "emacs", "vi", "vim", "nano", "pico", "top *"