ArticleslgStudy

science

Nohup

Nohup is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Nohup rather than just read about it. In short: nohup is a POSIX command which means "no hang up". Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out.

Key takeaways

  • Nohup belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Nohup to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Nohup from memory before moving on to harder problems.

Reference excerpt

nohup is a POSIX command which means "no hang up". Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out. Output that would normally go to the terminal goes to a file called nohup.out, if it has not already been redirected.

Use The first of the commands below starts the program abcd in the background in such a way that the subsequent logout does not stop it.

Note that these methods prevent the process from being sent a 'stop' signal on logout, but if input/output is being received for these standard I/O files (stdin, stdout, or stderr), they will still hang the terminal. See Overcoming hanging, below. nohup is often used in combination with the nice command to run processes on a lower priority.

Implementations Some shells (e.g. bash) provide a shell builtin that may be used to prevent SIGHUP being sent or propagated to existing jobs, even if they were not started with nohup. In bash, this can be obtained by using disown -h job; using the same builtin without arguments removes the job from the job table, which also implies that the job will not receive the signal. Before using disown on an active job, it should be stopped by Ctrl-Z, and continued in the background by the bg command. Another relevant bash option is shopt huponexit, which automatically sends the HUP signal to jobs when the shell is exiting normally. The AIX and Solaris versions of nohup have a -p option that modifies a running process to ignore future SIGHUP signals. Unlike the above-described disown builtin of bash, nohup -p accepts process IDs. The nohup command has also been ported to the IBM i operating system.

Overcoming hanging Note that nohupping backgrounded jobs is typically used to avoid terminating them when logging off from a remote SSH session. A different issue that often arises in this situation is that ssh is refusing to log off ("hangs"), since it refuses to lose any data from/to the background job(s). This problem can also be overcome by redirecting all three I/O streams:

Also note that a closing SSH session does not always send a HUP signal to dependent processes, such as when a pseudo-terminal has not been allocated.

Alternatives A terminal multiplexer can run a command in a separate session, detached from the current terminal, which means that if the current session ends, the detached session and its associated processes keeps running. One can then reattach to the session later on. For example, the following invocation of screen will run somescript.sh in the background of a detached session:

The disown shell builtin is used in some shells to remove jobs from the job table, or to mark jobs so that a SIGHUP signal is not sent on session termination.

References

External links nohup from Solaris's man pages

Worked examples

Example 1 — a first encounter with Nohup

Start with the simplest possible case. Write down what Nohup claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Nohup before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Nohup ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Nohup

In research
Nohup appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Nohup in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Nohup is common in secondary-school and first-year university syllabi. It links to neighbouring topics IBM i Qshell commands, Unix SUS2008 utilities, so understanding it makes those chapters shorter.
In everyday life
Look for Nohup outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Nohup” →

How to study Nohup in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Nohup means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Nohup out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Nohup in simple terms?

nohup is a POSIX command which means "no hang up". Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out.

Why does Nohup matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Nohup?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Nohup.

Tags

  • IBM i Qshell commands
  • Unix SUS2008 utilities

Keep exploring