Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use dwm as a window manager on Ubuntu, I like tiled windows and I like them as few as possible. I sometimes need to run an application (let's say it's the pdf viewer mupdf in x11) from the terminal, the application will be launched in a new window but the terminal from which I launched becomes this prompt-less console for that application to log whatever.

I use dmenu to launch applications, but sometimes an application needs arguments (file names) to start. I use uxrvt within x11 managed by dwm.

share|improve this question

2 Answers 2

up vote 23 down vote accepted

You could use the nohup to prevent the GUI to be attached to a terminal:

nohup mupdf some.pdf &

This will allow you to close the terminal you are launching from, without the program being closed.

You should also notice, that the nohup command will create a file with the stdout and stderr of the command you run. If you want to prevent that, add &>/dev/null before the &.

nohup mupdf some.pdf &>/dev/null &
share|improve this answer
4  
"nohup" stands for "no hang up". This dates back to early Unix, when (physical) terminals were regularly attached via telephone lines, and you'd therefore close a terminal by hanging up the phone. –  MSalters Aug 12 '13 at 8:05
3  
Additional information: The nohup command will create a file nohup.out containing output from the command. This is useful if you want to view error messages. If you don't want the file to be created, add redirection as follows: nohup mupdf some.pdf &>/dev/null & –  Paddy Landau Aug 13 '13 at 11:02

You can also use disown command. It is particularly useful when you've already started the process you no longer want attached to the terminal.

The basic procedure if I remember correctly, is something like this:

$ > firefox      #Oops
Ctrl + z         #Suspend the process
$ > bg           #Push the process to the background
$ > disown       #Detach most recent process started or stopped
$ > exit         #Terminal gone!

Note that disown is bash specific.

This blog post explains both methods pretty well.

Man page for disown

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.