FCI-Helwan blog

Just another FCI-H weblog

Linux Shell Tip #1

As you use linux you will have to type commands into the shell. In this series of posts i am going to tell you how to overcome some annoyances when using the linux shell.

If you open gedit (a simple text editor) through the command line (by typing gedit) you will find that the terminal is still open. And if you close the terminal gedit will be closed too.

To override this behaviour you can type :
nohup gedit

This way if you close the terminal gedit will not be closed.

So what happens and how does nohup solve it??

When you run any program through the shell, this program is opened as a child process to the shell process. That means that the shell is a parent process to the program you have just run. So when you close the parent process(The shell in our case), a hangup signal is sent to the child process (Your program) which closes as a result.

nohup (means “no hangups”) lets your program ignore those hangup signals, so that you can close the shell safely without mistakenly closing the program you have run.

Ofcourse, nohup is not constrained to gedit only. You can use it for any other program:
nohup “Your command”


February 19, 2007 - Posted by | Linux


  1. heyyyy….. that’s a useful piece of information… thanks

    Comment by Ahmed M. Farrag | February 21, 2007 | Reply

  2. I find it annoying that when I open some code in a text editor from the shell, I need another shell to compile it! Is there a command that allows you to continue to use the shell for other things while it is running a child operation?

    Comment by Charlie | December 4, 2007 | Reply

  3. @charlie
    of course, just add ampersand after the cmd name, ex:
    instead of typing;
    % xmms
    type :
    % xmms &

    if you forgot to add the “&” , so you should
    1- press ctrl + z
    2- then type bg (return) ( of course return means press the enter key )

    bg here means put the last running process in the background.

    Comment by m-hewedy | December 14, 2007 | Reply

  4. Great, that does the trick. Thanks a lot

    Comment by Charlie | December 14, 2007 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: