Macos – How to get back to the command line after launching a Node.js script

macososx-snow-leopardterminal

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 🙂

Best Answer

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 &
Related Question