title: How would I create a text file and fill it with sudo permission in bash
body: <p>I'm trying to create and fill a file in a directory that requires sudo permission. </p>
  
  <p>EDIT:
  It seems that based on tested the suggested similar post.</p>
  
  <pre><code>sudo su -c "echo 'put in file' &gt; file_name"
  echo "Some text" | sudo tee /etc/file
  </code></pre>
  
  <p>will both create a file within the directory that requires sudo permission</p>