title: Running a linux command from python
body: <p>I need to run this linux command from python and assign the output to a variable.</p>
  
  <pre><code>ps -ef | grep rtptransmit | grep -v grep
  </code></pre>
  
  <p>I've tried using pythons commands library to do this.</p>
  
  <pre><code>import commands
  a = commands.getoutput('ps -ef | grep rtptransmit | grep -v grep')
  </code></pre>
  
  <p>But a gets the end of cut off. The output I get is:</p>
  
  <pre><code>'nvr      20714 20711  0 10:39 ?        00:00:00 /opt/americandynamics/venvr/bin/rtptransmit setup_req db=media  camera=6  stream=video  substream=1  client_a'
  </code></pre>
  
  <p>but the expected output is:</p>
  
  <pre><code>nvr      20714 20711  0 10:39 ?        00:00:00 /opt/americandynamics/venvr/bin/rtptransmit setup_req db=media  camera=6  stream=video  substream=1  client_address=192.168.200.179  client_rtp_port=6970  override_lockout=1  clienttype=1
  </code></pre>
  
  <p>Does anyone know how to stop the output from getting cut off or can anyone suggest another method?</p>