Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

First off sorry for the noob question, I'm sure it's been asked before but I have no idea how to phrase it eloquently...

Sometimes when I open/run/execute (unsure of proper term) an application (?lol) from the terminal like geany ie:

geany filename.php

or maybe run a node.js script:

node server.js

The command will execute fine, but I'm then left without the ability to execute any other commands unless I open another terminal. my root@pcname:~$ is gone and when I try typing in something else and hitting Enter it just breaks to the next line.

I've noticed that sometimes I can hit CTRL+D and it'll give me my prompt back (sorry is prompt even the right name for it?)

So could someone please explain why this is happening and how I can get back to the prompt without opening another terminal.

Thanks, and sorry again for my noobery.

share|improve this question
up vote 3 down vote accepted

Ah, you're hitting the wrong key. It's Control + C. This is the command to force the current running application in the terminal to end. If you end the command it will also end the corresponding open application. So if you want to execute more commands in the same terminal, you have to press Control + C to exit the program, which will also exit geany. So it's best to simply run programs through the GUI, therefore saving you a lot of terminal windows. Or you can also use Ubuntu's run command function by pressing Alt + F2 and typing the command you want to run, no terminal required.

share|improve this answer
Thanks, so if I want the app to keep running, I'm stuck with multiple terminals... I actually just used geany as an example as it is sometimes an issue on my other box that has the GUI, but the machine running my node.js app is actually an amazon EC2 so no GUI. – jreed121 Apr 13 '12 at 1:42
Yep, that's right. You can have multiple tabs in one terminal, which will help your sanity. Could you please also please click the green checkmark under the down arrow toward the top of my answer? (I get brownie points). Thanks. – William Apr 13 '12 at 1:48
Yes. You can have multiple tabs in terminal, which might help your sanity. – William Apr 13 '12 at 1:49
well here's the other thing, I'm using PuTTy on my win7 home desktop - is there a way to have tabs in PuTTY? Or is there a better client for windows? – jreed121 Apr 13 '12 at 1:55
Yes you can have tabs in PuTTY, see this link: – William Apr 13 '12 at 2:06

If what you're really trying to do is start a GUI program from the terminal, you may prefer something like

geany filename.php &

which will start it in the background, since it doesn't need the terminal for anything. This may also work for the node.js application, if it doesn't require the terminal for anything.

If they're still running when you close the terminal, it will complain. If you really want them to stick around after the terminal exits, use disown.

share|improve this answer
Right except for the fact that background operations don't complain if when you close if you're using gnome-terminal – RobotHumans Apr 13 '12 at 1:56
But what happens when I disown? Will I not be able to stop them afterwards? – jreed121 Apr 13 '12 at 1:58
Not from the terminal; but the point of disown is precisely when you don't want the terminal to be involved with it any more. You would have to use some other mechanism to keep track of it; for example, for the node.js service you would note the job's process ID that the shell prints when you start it, and could use that to kill it from a different terminal. (Better for that case might be to have your service use a pidfile, or have some protocol command that tells it to exit.) – geekosaur Apr 13 '12 at 2:10
I tried it and the & wont work since it stops the node.js script but the disown works nicely, but I'm unsure of any negative drawbacks... – jreed121 Apr 13 '12 at 2:10
That suggests node.js is reading from the terminal for some reason. I would not know the details there, I don't know what it's running. – geekosaur Apr 13 '12 at 2:15

After you start a process (job), you can still do other things. You might want to write these down as a cheat sheet.

  1. Ctrl+c Kill the running process (foreground job)
  2. Ctrl+z Pause running process (foreground job) and return to the prompt
  3. Type jobs Shows you all background jobs on the terminal
  4. Type bg Makes the last paused job continue in the background
  5. Type fg Returns the last pause job to the foreground

You can also type bg or fg with a number after, like fg 3. This will bring job #3 to the foreground.

If you are going to background a process, and you don't want it outputting a bunch of text, just put > filename.txt after it, like this process > out.txt. This will make it send all standard output to the file out.txt (and not clutter your terminal).

If you use terminals often (like me :) then you definitely want to install and become familiar with the terminal program called screen. It allows you to have multiple virtual terminals in 1 window, and if you close the terminal window (on accident?), you can reopen it exactly where you left off from before.

share|improve this answer
to avoid writing all that output to a file, you can redirect to /dev/null: process >& /dev/null & – steabert Aug 24 '12 at 20:38

i use geany for tcl/tk. if you open geany, look for the "build" icon. it will let you create commands to be launched with a mouse click. click the icon then set build commands then edit the execute entry to something like this: sh %f && exit you may have to tweak it to your needs. replace sh with whatever runs your code. you must use 2 amperstands also. it opens a terminal and runs the gui script. when i am done examining the gui i am creating, i close the terminal window which kills the gui script. it also removes the limitations of the built in terminal. but alas, you still have to close the terminal to get a clean slate.

share|improve this answer

Your Answer


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.