Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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! –  Yar 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.