Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm on a Mac OS X 10.6.7.

I started a node.js script, which starts an HTTP server.

The problem is that I lost the command line, it looks like this:

$me cd directory
$me node test.js
Message from test.js: Server is running on localhost
..|

| = indicates the caret

It's possible to write but I'm unable to run any code, it's like writing a plain string, how can I get back to the commmand line?

Sorry I'm really noob in terminal :)

share|improve this question
up vote 5 down vote accepted

Press Ctrl+C to terminate the program and get back to the shell prompt.

If you want a program to run in the background and return you to a shell prompt, append an ampersand (&) to the end of the command. For example:

node test.js &
share|improve this answer
    
If you want to keep it running press [ctrl] + [z] then type bg – Chris Nava Apr 7 '11 at 4:27
    
Thanks @ChrisNava I never knew that you could do bg and fg without using %1 (or %something). Great point! – Dan Rosenstark Oct 27 '11 at 5:37

Just open a new tab by pressing Cmd-T, or a new window (using Cmd-N). You want to get warning/error messages that program sends to your terminal.


You can also use screen to get multiple... er... terminals in a single tab/window.

Press Ctrl-A Ctrl-C to create a new terminal, Ctrl-A Ctrl-N or Ctrl-A Ctrl-P (repeatedly) to go to the next and previous terminals. Type exit in all screen terminals to leave.


Regarding node: Check the documentation -- it should be possible to start it as a background server.

share|improve this answer

Just type Q to get back to the command line, from the help module.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .