How to run process in the background on Linux temrminal

Sometimes we would need to just run a program in the background and let it do its work without bothering us.
We can do this using the Linux tool nohup. The name of this command comes from ‘no hangup’.

nohup node server.js > /dev/null 2>&1 &

nohup means: Do not terminate this process even when the stty is cut off.

/dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output).
2>&1 means: stderr also goes to the stdout (which is already redirected to /dev/null). You may replace &1 with a file path to keep a log of errors, e.g.: 2>/tmp/myLog
& at the end means: run this command as a background task.

Setting up Prometheus with Kubernetes service discovery Securing your ELK stack - setting ElasticSearch, Kibana and Logstash security

Comments