<p>I know a few advanced ways, to change directories. <code>pushd</code> and <code>popd</code> (directory stack) or <code>cd -</code> (change to last directory).</p>

<p>But I am looking for quick way to achieve the following:</p>

<p>Say, I am in a rather deep dir:</p>

<pre><code>/this/is/a/very/deep/directory/structure/with\ lot\ of\ nasty/names
</code></pre>

<p>and I want to switch to  </p>

<pre><code>/this/is/another/very/deep/directory/structure/with\ lot\ of\ nasty/names
</code></pre>

<p>Is there a cool/quick/geeky way to do it (without the mouse)?</p>

[{'answer_id': 60887, 'author': 'dF.', 'author_id': 3002, 'author_profile': 'https://Stackoverflow.com/users/3002', 'pm_score': 4, 'selected': True, 'text': '<p>Do you mean that the path names are the same, and only one directory name changes ("a" becomes "another")? In that case:</p>\n\n<pre><code>cd ${PWD/a/another}\n</code></pre>\n\n<p>will switch to the other directory. <code>$PWD</code> holds your current directory, and <code>${var/foo/bar}</code> gives you <code>$var</code> with the string \'foo\' replaced by \'bar\'.</p>\n'}, {'answer_id': 60936, 'author': 'Rob Wells', 'author_id': 2974, 'author_profile': 'https://Stackoverflow.com/users/2974', 'pm_score': 2, 'selected': False, 'text': '<p>What about setting up your <code>CDPATH</code> variable?</p>\n'}, {'answer_id': 66331, 'author': 'slipset', 'author_id': 9422, 'author_profile': 'https://Stackoverflow.com/users/9422', 'pm_score': 1, 'selected': False, 'text': '<pre><code>cd ^/a/^/another/\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/60874', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1870/']