To clear the terminal manually:
⌘+K
Command+K for newer keyboards
To clear the terminal from within a shell script;
/usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down'
- CTRL+E (for a list of editor)
- CTRL+F6 (for switching to the next editor through a list)
You can assign another shortcut to the 'Next Editor' key.
are the two official shortcuts, but they both involve a list being displayed.
CTRL+Page Up / CTRL+Page Down can cycle through editors without displaying a list.
What is interesting with that last set of shortcuts is:
they are not listed in the Eclipse Keys shortcuts to be defined.
They may be inherited from the multipage editor, making them an OS specific shortcut.
Regarding shortcuts on Mac OS (OSX), Matt Ball complained in Sept. 2011 to not being able to remap CTRL+Page Up/CTRL+Page Down:
It drives me nuts to not be able to flip through open tabs as I can in pretty much every other tabbed program in OS X (⌘-Left and ⌘-Right).
Well, in March 2012, Arthur replied:
, I've just downloaded the latest version of Eclipse (3.7+). I've been able to bind "Previous/Next tab" to (⌘-Left and ⌘-Right) when in Editor, which I'm pretty sure I couldn't do before.
So I guess they heard you.
It works just as you expect, tabs going from left to right and vice-versa, not on a history basis or some nonsense like that.
Matt Ball confirms:
oh wow, selecting "Editing Java Source" actually worked!
Now, unfortunately this means that I'm SOL if I nav into a non-Java file (JSP, XML, JS, etc.).
The fix for this is to "copy command" for this pair, and select all the "whens" that I want.
So far it's at least working beautifully for Java and JSP files.
This is a major PITA to set up, but it's just a one-time thing.
His exported preferences are available here for you to try.
Once imported, you should see, for all the relevant types of document:
Best Answer
Update: This answer gained popularity based on the shell function posted below, which still works as of OSX 10.10 (with the exception of the
-g
option).However, a more fully featured, more robust, tested script version is now available at the npm registry as CLI
ttab
, which also supports iTerm2:If you have Node.js installed, simply run:
(depending on how you installed Node.js, you may have to prepend
sudo
).Otherwise, follow these instructions.
Once installed, run
ttab -h
for concise usage information, orman ttab
to view the manual.Building on the accepted answer, below is a bash convenience function for opening a new tab in the current Terminal window and optionally executing a command (as a bonus, there's a variant function for creating a new window instead).
If a command is specified, its first token will be used as the new tab's title.
Sample invocations:
CAVEAT: When you run
newtab
(ornewwin
) from a script, the script's initial working folder will be the working folder in the new tab/window, even if you change the working folder inside the script before invokingnewtab
/newwin
- passeval
with acd
command as a workaround (see example above).Source code (paste into your bash profile, for instance):