Local Cloud: access console output externally

So to fire up the local :cloud:, we will use node main.js

There are times where I accidentally turn off the terminal :stuck_out_tongue:

Is there a way to “go back” and continue to monitor the console.log of the running main.js somehow?

Thanks!

You could use screen, if you’re on Mac or Linux. You can Google up plenty of tutorials (search for gnu screen). Here are a couple:

http://www.debian-administration.org/article/34/Using_GNU_Screen
http://www.linux.com/learn/tutorials/285795-taking-command-of-the-terminal-with-gnu-screen-

I always use screen when I login to a remote machine (assuming it’s available or I can install it). The most awesome feature is that if you get disconnected from the host while using screen (like if your wifi goes down, or your kid closes your laptop lid), you can just reconnect to the host, and screen -RRD, and you’re right back where you left off.

So, a really quick screen command primer:

You can just run screen by itself, and you’ll get a new command-line shell. Or you can start it out running a particular program, e.g.: screen node main.js

While in screen, if you need another shell, use ^A-c (CTRL-A, then lowercase ‘c’). You can swap your view between the last two screens you visited with ^A-^A. If you have more than two screens in your session, you can use ^A-n and ^A-p (think ‘next’ and ‘previous’) to cycle through them.

For logging to a file, you can use ^A-H to start and stop logging to a file (screenlog.n). Or if you need to see something that just scrolled off the top of your window, use ^A-ESC to start ‘copy mode’. Then you can use your up and down arrow keys to scroll a line at a time, or ^U and ^D to go up and down a half-page at a time (actually, lots of vi movement commands work here).

If you need to send a literal CTRL-A keystroke to a program running within screen, use ^A-a.

1 Like