3

I have a file called "nohup.out". It is consuming a lot of space and I will like to remove it.

/opt/apache-activemq-5.2.0/bin/nohup.out: 4.2G

Will it affect the application in any way? I do not want logs, only disk space.

shantanuo
  • 3,459
  • 8
  • 47
  • 64

3 Answers3

3

That's the output of a file produced by the nohup program, which is used to run things in the context of a shell, but without the program being killed when the shell is exited. You can delete it if you don't want what's in it, but if the program that created the file is still running, then the disk space won't actually be reclaimed until the program exits.

Also, the chances are that whatever created the file will probably do it again in the future, so you really want to run activemq as a proper daemon, rather than someone logging in and running it in a shell with nohup.

womble
  • 95,029
  • 29
  • 173
  • 228
3

As another idea, you could run it so that there is no output to be placed into nohup.out:

Just start the command like this:

nohup command > /dev/null

This will cause the output from everything to be sent to "/dev/null" and disappear. If you don't care about the logs, this is the easiest way to stop the file from taking up room on the HDD...

Soviero
  • 4,306
  • 7
  • 34
  • 59
3

you can clear nohup.out by

cat /dev/null > nohup.out
fakturk
  • 131
  • 2
  • 2
    Looks like yet another UUOC. `> nohup.out` is sufficient. So is just deleting it. – Michael Hampton Nov 03 '18 at 15:36
  • @MichaelHampton Deleting it won't free the space immediately if the program is still running. That is also pointed out by the accepted answer, which however doesn't mention how to free the space if the program is still running. – kasperd Nov 03 '18 at 20:36