title: One command to create a directory and file inside it linux command
body: <p>Suppose my current directory is <strong>A</strong>. I want to create a directory <strong>B</strong> and a file "myfile.txt" inside <strong>B</strong>.</p>
  
  <p>How to do that in one command from Terminal?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Directory can be nested multiple times. Like I may want to create <strong>B/C/D</strong> and then "myfile.txt" inside that. I do not also want to repeat the directory part.</p>
  
  <p>Following command will create directory at any level.</p>
  
  <pre><code>mkdir -p B/C/D 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>mkdir -p B/C/D &amp;&amp; touch B/C/D/myfile.txt
  </code></pre>
  
  <p>will create the directory and the file. But I do not want to repeat the directory part after the <code>touch</code> command. Is that possible?</p>