Launching scripts from bash and directing outputs
<p>I have a question about syntax of bash regarding launching scripts from within bash script.</p>

<p>My questions are:   </p>

<ol>
<li><p>I've seen the following syntax:</p>

<pre><code>#!/bin/bash
python do_something.py &gt; /dev/null 2&gt;&amp;1 &amp;
</code></pre>

<p>Can you please explain what is directed to <code>/dev/null</code>, and what is the meaning of <code>2&gt;&amp;1</code> if before already mentioned <code>/dev/null</code>?</p></li>
<li><p>In addition if I have a line defined like:</p>

<pre><code>python do_something.py &gt; 2&gt;&amp;1 &amp;
</code></pre>

<p>how is that different?</p></li>
<li><p>If I have the same python file in many paths, how can I differentiate between each process after launching <code>ps -ef |grep python</code>.
When I'm doing so, I get a list of processes which are all called <code>do_something.py</code>, it would be nice if I could have the full execution path string of each pid; how can I do that?</p></li>
</ol>

<p><strong>NOTE:</strong> The python file launched is writing its own log files.</p>

<p>Answers:</p>

<p>1, 2. <code>&gt;</code> redirects whatever that is printed in <code>stdout</code> as result of executing the command (in your case <code>python do_something.py</code>) to a file called <code>/dev/null</code>. The <code>/dev/null</code> is kind of a black hole. Whatever you write to it disappers.</p>

<p><code>2&gt;&amp;1</code> redirects the output of <code>stderr</code> (which has fd as 2) to <code>stdout</code> (whose fd is 1).</p>

<p>Refer <a href="http://www.tldp.org/LDP/abs/html/io-redirection.html" rel="nofollow">I/O redirection</a> for more info about redirections.</p>

<p>Refer <a href="http://tldp.org/LDP/abs/html/zeros.html" rel="nofollow">this</a> link for more info about <code>/dev/null</code></p>

python linux bash