[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 458
  • Last Modified:

Linux: nohup without output

This  returns output like this: "[1] 23936"
nohup doSomething >/dev/null &

Open in new window


How can I do this without any output?
0
hankknight
Asked:
hankknight
  • 2
2 Solutions
 
pritamduttCommented:
The usage of  & symbol causes this job to run in background which causes the program to return the PID assigned to it

change the command to
nohup doSomething >/dev/null & > /dev/null

an try.


hope this helps!
0
 
hankknightAuthor Commented:
That does not work.  Try it:
nohup ls >/dev/null & > /dev/null

Open in new window

0
 
pritamduttCommented:
I only get a message nohup: ignoring input and appending output to 'nohup.out'

I tried
1. nohup ls -lR & > /dev/null
2. nohup ls -lR > /dev/null & > /dev/null

0
 
Kerem ERSOYPresidentCommented:
Hi,

The output comes from the OS not the command because "&" causes the command to be executed in background. One way to avoid this is to run it from within another shell such as:

bash -c "nohup doSomething &" > /dev/null

Cheers,
K.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now