title: linux cd to folder containing the file
body: <p>Having a file path I would like to go to the directory of the file. A full path is like this:</p>
  
  <pre><code>/Users/user1/Documents/workspace/project/src/file.py
  </code></pre>
  
  <p>I would like in terminal to go the folder containing this file. 
  In this case it would be: </p>
  
  <pre><code>/Users/user1/Documents/workspace/project/src/
  </code></pre>
  
  <p>Right now I have to paste the file in terminal, delete the file name and do cd. Like:</p>
  
  <pre><code>cd /Users/user1/Documents/workspace/project/src/
  </code></pre>
  
  <p>Is there a command/ any way I can skip deleting the file and use a smart command to know it should go to the directory containing this file? </p>
  
  <p>I have to examine daily a lot of files and deleting the filename from path everytime is becoming a very tedious task.</p>
  
  <p>The desired action would be something like this: </p>
  
  <pre><code>&gt;&gt;smart_cd /path/to/file.py
  &gt;&gt;pwd
  /path/to
  </code></pre>