Go back to previous directory in shell











up vote
279
down vote

favorite
80












Is there a way to go back to previous directory we were in using bash,tcsh without using pushd/popd ?
I'd like to type something like "back" and got returned to the previous directory I was in.



Edit:



"cd -" works, but only for current and previous directories. Is there anyway I can go back to the previous previous previous directory like how you can go back in the web browser?



Regards










share|improve this question




















  • 1




    As noted below, you can do so using "pushd" and "popd".
    – blueyed
    Mar 5 '10 at 3:02








  • 8




    Just a side note "cd --" goes to the user default direcotry (/home/username)
    – sdaffa23fdsf
    Apr 8 '12 at 22:49






  • 1




    Best answer imho : unix.stackexchange.com/a/180640/158177 provides cd -1 to cd -9 which I think is what the OP asked for
    – Titou
    Sep 29 '16 at 15:11















up vote
279
down vote

favorite
80












Is there a way to go back to previous directory we were in using bash,tcsh without using pushd/popd ?
I'd like to type something like "back" and got returned to the previous directory I was in.



Edit:



"cd -" works, but only for current and previous directories. Is there anyway I can go back to the previous previous previous directory like how you can go back in the web browser?



Regards










share|improve this question




















  • 1




    As noted below, you can do so using "pushd" and "popd".
    – blueyed
    Mar 5 '10 at 3:02








  • 8




    Just a side note "cd --" goes to the user default direcotry (/home/username)
    – sdaffa23fdsf
    Apr 8 '12 at 22:49






  • 1




    Best answer imho : unix.stackexchange.com/a/180640/158177 provides cd -1 to cd -9 which I think is what the OP asked for
    – Titou
    Sep 29 '16 at 15:11













up vote
279
down vote

favorite
80









up vote
279
down vote

favorite
80






80





Is there a way to go back to previous directory we were in using bash,tcsh without using pushd/popd ?
I'd like to type something like "back" and got returned to the previous directory I was in.



Edit:



"cd -" works, but only for current and previous directories. Is there anyway I can go back to the previous previous previous directory like how you can go back in the web browser?



Regards










share|improve this question















Is there a way to go back to previous directory we were in using bash,tcsh without using pushd/popd ?
I'd like to type something like "back" and got returned to the previous directory I was in.



Edit:



"cd -" works, but only for current and previous directories. Is there anyway I can go back to the previous previous previous directory like how you can go back in the web browser?



Regards







linux command-line bash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 25 '10 at 7:10

























asked Feb 25 '10 at 6:44









portoalet

2,33282534




2,33282534








  • 1




    As noted below, you can do so using "pushd" and "popd".
    – blueyed
    Mar 5 '10 at 3:02








  • 8




    Just a side note "cd --" goes to the user default direcotry (/home/username)
    – sdaffa23fdsf
    Apr 8 '12 at 22:49






  • 1




    Best answer imho : unix.stackexchange.com/a/180640/158177 provides cd -1 to cd -9 which I think is what the OP asked for
    – Titou
    Sep 29 '16 at 15:11














  • 1




    As noted below, you can do so using "pushd" and "popd".
    – blueyed
    Mar 5 '10 at 3:02








  • 8




    Just a side note "cd --" goes to the user default direcotry (/home/username)
    – sdaffa23fdsf
    Apr 8 '12 at 22:49






  • 1




    Best answer imho : unix.stackexchange.com/a/180640/158177 provides cd -1 to cd -9 which I think is what the OP asked for
    – Titou
    Sep 29 '16 at 15:11








1




1




As noted below, you can do so using "pushd" and "popd".
– blueyed
Mar 5 '10 at 3:02






As noted below, you can do so using "pushd" and "popd".
– blueyed
Mar 5 '10 at 3:02






8




8




Just a side note "cd --" goes to the user default direcotry (/home/username)
– sdaffa23fdsf
Apr 8 '12 at 22:49




Just a side note "cd --" goes to the user default direcotry (/home/username)
– sdaffa23fdsf
Apr 8 '12 at 22:49




1




1




Best answer imho : unix.stackexchange.com/a/180640/158177 provides cd -1 to cd -9 which I think is what the OP asked for
– Titou
Sep 29 '16 at 15:11




Best answer imho : unix.stackexchange.com/a/180640/158177 provides cd -1 to cd -9 which I think is what the OP asked for
– Titou
Sep 29 '16 at 15:11










6 Answers
6






active

oldest

votes

















up vote
379
down vote



accepted










cd - (goes back to previous directory)



If you want to be able to go to the other previous directories, this is not possible out of the box. But check this script and instructions:



History of visited directories in BASH




The cd command works as usual. The new
feature is the history of the last 10
directories and the cd command
expanded to display and access it. cd
-- (or simply pressing ctrl+w) shows the history. In front of every
directory name you see a number. cd
-num with the number you want jumps to the corresponding directory from the
history.







share|improve this answer



















  • 19




    also pushd and popd might be useful
    – lorenzog
    Feb 25 '10 at 8:55






  • 6




    @lorenzog : lydonchandra, in his question, said "without using pushd/popd"
    – Snark
    Feb 25 '10 at 9:19










  • @ogc-nick for using this cd -- in menu-like manner, you should use the mentioned script
    – Ram
    Feb 11 '16 at 6:13






  • 1




    @ogc-nick no it doesn't. The -- simply separates a command and its options from the parameters (see this post). Because no arguments follow after --, the final command is just cd which switches to your home directory. That might have been the second previous directory, but that's just a coincidence.
    – Griddo
    Mar 8 at 9:02










  • wow syntactic sugar much
    – user2230470
    Jun 24 at 2:00


















up vote
21
down vote













You can also use variable cd $OLDPWD. This can be also used in shell scripts.






share|improve this answer

















  • 6




    $OLDPWD maintains the last directory you came from which is good for scripts. I use $OLDPWD with cp command a lot. E.g cp -v $OLDPWD/file .
    – Neil Wightman
    Jan 9 '15 at 9:12












  • @NeilWightman Great little gem. Thank you!
    – joshperry
    Jun 8 '16 at 16:41


















up vote
0
down vote













If you've gone down the directory tree and want to go back up, .. is my personal favorite. You can jump around within a branch of the tree quite easily with .. going up one directory and ../.. two and ../../.. three, etc. You can also go up and down a different branch with the same command, such as cd ../../example or cd ../../../example/example etc. For a simple switch that goes back and forth between directories, cd - or $OLDPWD are your best bets, as others mentioned.






share|improve this answer




























    up vote
    0
    down vote













    For Windows (including Node.js commads prompt console case) does not works cd - To moves you up one directory works



    cd ..





    share|improve this answer

















    • 2




      cd .. moves to parent directory, which is not what was the subject of question.
      – ViaSat
      Mar 28 at 16:24










    • This is bash here, not Windows.
      – Timo
      Apr 5 at 12:37


















    up vote
    -1
    down vote













    I think cd .. might help. If you do a ls -a in any directory you would see that there are two entries: one named "." and another named ".."; the single dot is reference to the directory you are already in, while the double is the previous directory in the path.






    share|improve this answer

















    • 20




      .. is not the previous directory, it's just the parent directory.
      – Der Hochstapler
      Dec 10 '12 at 10:28






    • 4




      This answer provides useful information even if it does not answer correctly the question. Therefore there is no point in piling negative votes on it, I upvoted for the effort.
      – Titou
      Sep 29 '16 at 12:36








    • 1




      This is not Berkley, there are no special awards just for participation
      – nathanchere
      May 24 '17 at 9:45


















    up vote
    -1
    down vote













    I find the easiest way to do it is with this .bashrc power edit: https://github.com/wting/autojump .
    You get to "mark" folders you navigate to, giving them a shorthand name that's easy to remember (my advice; the foregoing is not in the docs), such as Pics for Pictures, etc. 'jump' returns you to the folder you 'marked,' and 'marks' lists folders you have added to the 'stack' (as with pushd and popd), with the added advantage that your marks remain the same from one session to the next, ad infinitum.



    I have yet to try it on more than one harddrive, but the results should be similar to those using a single volume.



    S Wright






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f113219%2fgo-back-to-previous-directory-in-shell%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      379
      down vote



      accepted










      cd - (goes back to previous directory)



      If you want to be able to go to the other previous directories, this is not possible out of the box. But check this script and instructions:



      History of visited directories in BASH




      The cd command works as usual. The new
      feature is the history of the last 10
      directories and the cd command
      expanded to display and access it. cd
      -- (or simply pressing ctrl+w) shows the history. In front of every
      directory name you see a number. cd
      -num with the number you want jumps to the corresponding directory from the
      history.







      share|improve this answer



















      • 19




        also pushd and popd might be useful
        – lorenzog
        Feb 25 '10 at 8:55






      • 6




        @lorenzog : lydonchandra, in his question, said "without using pushd/popd"
        – Snark
        Feb 25 '10 at 9:19










      • @ogc-nick for using this cd -- in menu-like manner, you should use the mentioned script
        – Ram
        Feb 11 '16 at 6:13






      • 1




        @ogc-nick no it doesn't. The -- simply separates a command and its options from the parameters (see this post). Because no arguments follow after --, the final command is just cd which switches to your home directory. That might have been the second previous directory, but that's just a coincidence.
        – Griddo
        Mar 8 at 9:02










      • wow syntactic sugar much
        – user2230470
        Jun 24 at 2:00















      up vote
      379
      down vote



      accepted










      cd - (goes back to previous directory)



      If you want to be able to go to the other previous directories, this is not possible out of the box. But check this script and instructions:



      History of visited directories in BASH




      The cd command works as usual. The new
      feature is the history of the last 10
      directories and the cd command
      expanded to display and access it. cd
      -- (or simply pressing ctrl+w) shows the history. In front of every
      directory name you see a number. cd
      -num with the number you want jumps to the corresponding directory from the
      history.







      share|improve this answer



















      • 19




        also pushd and popd might be useful
        – lorenzog
        Feb 25 '10 at 8:55






      • 6




        @lorenzog : lydonchandra, in his question, said "without using pushd/popd"
        – Snark
        Feb 25 '10 at 9:19










      • @ogc-nick for using this cd -- in menu-like manner, you should use the mentioned script
        – Ram
        Feb 11 '16 at 6:13






      • 1




        @ogc-nick no it doesn't. The -- simply separates a command and its options from the parameters (see this post). Because no arguments follow after --, the final command is just cd which switches to your home directory. That might have been the second previous directory, but that's just a coincidence.
        – Griddo
        Mar 8 at 9:02










      • wow syntactic sugar much
        – user2230470
        Jun 24 at 2:00













      up vote
      379
      down vote



      accepted







      up vote
      379
      down vote



      accepted






      cd - (goes back to previous directory)



      If you want to be able to go to the other previous directories, this is not possible out of the box. But check this script and instructions:



      History of visited directories in BASH




      The cd command works as usual. The new
      feature is the history of the last 10
      directories and the cd command
      expanded to display and access it. cd
      -- (or simply pressing ctrl+w) shows the history. In front of every
      directory name you see a number. cd
      -num with the number you want jumps to the corresponding directory from the
      history.







      share|improve this answer














      cd - (goes back to previous directory)



      If you want to be able to go to the other previous directories, this is not possible out of the box. But check this script and instructions:



      History of visited directories in BASH




      The cd command works as usual. The new
      feature is the history of the last 10
      directories and the cd command
      expanded to display and access it. cd
      -- (or simply pressing ctrl+w) shows the history. In front of every
      directory name you see a number. cd
      -num with the number you want jumps to the corresponding directory from the
      history.








      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Feb 1 '14 at 14:45

























      answered Feb 25 '10 at 6:50









      Snark

      28.8k67689




      28.8k67689








      • 19




        also pushd and popd might be useful
        – lorenzog
        Feb 25 '10 at 8:55






      • 6




        @lorenzog : lydonchandra, in his question, said "without using pushd/popd"
        – Snark
        Feb 25 '10 at 9:19










      • @ogc-nick for using this cd -- in menu-like manner, you should use the mentioned script
        – Ram
        Feb 11 '16 at 6:13






      • 1




        @ogc-nick no it doesn't. The -- simply separates a command and its options from the parameters (see this post). Because no arguments follow after --, the final command is just cd which switches to your home directory. That might have been the second previous directory, but that's just a coincidence.
        – Griddo
        Mar 8 at 9:02










      • wow syntactic sugar much
        – user2230470
        Jun 24 at 2:00














      • 19




        also pushd and popd might be useful
        – lorenzog
        Feb 25 '10 at 8:55






      • 6




        @lorenzog : lydonchandra, in his question, said "without using pushd/popd"
        – Snark
        Feb 25 '10 at 9:19










      • @ogc-nick for using this cd -- in menu-like manner, you should use the mentioned script
        – Ram
        Feb 11 '16 at 6:13






      • 1




        @ogc-nick no it doesn't. The -- simply separates a command and its options from the parameters (see this post). Because no arguments follow after --, the final command is just cd which switches to your home directory. That might have been the second previous directory, but that's just a coincidence.
        – Griddo
        Mar 8 at 9:02










      • wow syntactic sugar much
        – user2230470
        Jun 24 at 2:00








      19




      19




      also pushd and popd might be useful
      – lorenzog
      Feb 25 '10 at 8:55




      also pushd and popd might be useful
      – lorenzog
      Feb 25 '10 at 8:55




      6




      6




      @lorenzog : lydonchandra, in his question, said "without using pushd/popd"
      – Snark
      Feb 25 '10 at 9:19




      @lorenzog : lydonchandra, in his question, said "without using pushd/popd"
      – Snark
      Feb 25 '10 at 9:19












      @ogc-nick for using this cd -- in menu-like manner, you should use the mentioned script
      – Ram
      Feb 11 '16 at 6:13




      @ogc-nick for using this cd -- in menu-like manner, you should use the mentioned script
      – Ram
      Feb 11 '16 at 6:13




      1




      1




      @ogc-nick no it doesn't. The -- simply separates a command and its options from the parameters (see this post). Because no arguments follow after --, the final command is just cd which switches to your home directory. That might have been the second previous directory, but that's just a coincidence.
      – Griddo
      Mar 8 at 9:02




      @ogc-nick no it doesn't. The -- simply separates a command and its options from the parameters (see this post). Because no arguments follow after --, the final command is just cd which switches to your home directory. That might have been the second previous directory, but that's just a coincidence.
      – Griddo
      Mar 8 at 9:02












      wow syntactic sugar much
      – user2230470
      Jun 24 at 2:00




      wow syntactic sugar much
      – user2230470
      Jun 24 at 2:00












      up vote
      21
      down vote













      You can also use variable cd $OLDPWD. This can be also used in shell scripts.






      share|improve this answer

















      • 6




        $OLDPWD maintains the last directory you came from which is good for scripts. I use $OLDPWD with cp command a lot. E.g cp -v $OLDPWD/file .
        – Neil Wightman
        Jan 9 '15 at 9:12












      • @NeilWightman Great little gem. Thank you!
        – joshperry
        Jun 8 '16 at 16:41















      up vote
      21
      down vote













      You can also use variable cd $OLDPWD. This can be also used in shell scripts.






      share|improve this answer

















      • 6




        $OLDPWD maintains the last directory you came from which is good for scripts. I use $OLDPWD with cp command a lot. E.g cp -v $OLDPWD/file .
        – Neil Wightman
        Jan 9 '15 at 9:12












      • @NeilWightman Great little gem. Thank you!
        – joshperry
        Jun 8 '16 at 16:41













      up vote
      21
      down vote










      up vote
      21
      down vote









      You can also use variable cd $OLDPWD. This can be also used in shell scripts.






      share|improve this answer












      You can also use variable cd $OLDPWD. This can be also used in shell scripts.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jan 9 '15 at 8:27









      Ales Dolecek

      31123




      31123








      • 6




        $OLDPWD maintains the last directory you came from which is good for scripts. I use $OLDPWD with cp command a lot. E.g cp -v $OLDPWD/file .
        – Neil Wightman
        Jan 9 '15 at 9:12












      • @NeilWightman Great little gem. Thank you!
        – joshperry
        Jun 8 '16 at 16:41














      • 6




        $OLDPWD maintains the last directory you came from which is good for scripts. I use $OLDPWD with cp command a lot. E.g cp -v $OLDPWD/file .
        – Neil Wightman
        Jan 9 '15 at 9:12












      • @NeilWightman Great little gem. Thank you!
        – joshperry
        Jun 8 '16 at 16:41








      6




      6




      $OLDPWD maintains the last directory you came from which is good for scripts. I use $OLDPWD with cp command a lot. E.g cp -v $OLDPWD/file .
      – Neil Wightman
      Jan 9 '15 at 9:12






      $OLDPWD maintains the last directory you came from which is good for scripts. I use $OLDPWD with cp command a lot. E.g cp -v $OLDPWD/file .
      – Neil Wightman
      Jan 9 '15 at 9:12














      @NeilWightman Great little gem. Thank you!
      – joshperry
      Jun 8 '16 at 16:41




      @NeilWightman Great little gem. Thank you!
      – joshperry
      Jun 8 '16 at 16:41










      up vote
      0
      down vote













      If you've gone down the directory tree and want to go back up, .. is my personal favorite. You can jump around within a branch of the tree quite easily with .. going up one directory and ../.. two and ../../.. three, etc. You can also go up and down a different branch with the same command, such as cd ../../example or cd ../../../example/example etc. For a simple switch that goes back and forth between directories, cd - or $OLDPWD are your best bets, as others mentioned.






      share|improve this answer

























        up vote
        0
        down vote













        If you've gone down the directory tree and want to go back up, .. is my personal favorite. You can jump around within a branch of the tree quite easily with .. going up one directory and ../.. two and ../../.. three, etc. You can also go up and down a different branch with the same command, such as cd ../../example or cd ../../../example/example etc. For a simple switch that goes back and forth between directories, cd - or $OLDPWD are your best bets, as others mentioned.






        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          If you've gone down the directory tree and want to go back up, .. is my personal favorite. You can jump around within a branch of the tree quite easily with .. going up one directory and ../.. two and ../../.. three, etc. You can also go up and down a different branch with the same command, such as cd ../../example or cd ../../../example/example etc. For a simple switch that goes back and forth between directories, cd - or $OLDPWD are your best bets, as others mentioned.






          share|improve this answer












          If you've gone down the directory tree and want to go back up, .. is my personal favorite. You can jump around within a branch of the tree quite easily with .. going up one directory and ../.. two and ../../.. three, etc. You can also go up and down a different branch with the same command, such as cd ../../example or cd ../../../example/example etc. For a simple switch that goes back and forth between directories, cd - or $OLDPWD are your best bets, as others mentioned.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 3 '16 at 15:30









          Adam Erickson

          1394




          1394






















              up vote
              0
              down vote













              For Windows (including Node.js commads prompt console case) does not works cd - To moves you up one directory works



              cd ..





              share|improve this answer

















              • 2




                cd .. moves to parent directory, which is not what was the subject of question.
                – ViaSat
                Mar 28 at 16:24










              • This is bash here, not Windows.
                – Timo
                Apr 5 at 12:37















              up vote
              0
              down vote













              For Windows (including Node.js commads prompt console case) does not works cd - To moves you up one directory works



              cd ..





              share|improve this answer

















              • 2




                cd .. moves to parent directory, which is not what was the subject of question.
                – ViaSat
                Mar 28 at 16:24










              • This is bash here, not Windows.
                – Timo
                Apr 5 at 12:37













              up vote
              0
              down vote










              up vote
              0
              down vote









              For Windows (including Node.js commads prompt console case) does not works cd - To moves you up one directory works



              cd ..





              share|improve this answer












              For Windows (including Node.js commads prompt console case) does not works cd - To moves you up one directory works



              cd ..






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 7 '17 at 3:31









              IgorBeaz

              1573




              1573








              • 2




                cd .. moves to parent directory, which is not what was the subject of question.
                – ViaSat
                Mar 28 at 16:24










              • This is bash here, not Windows.
                – Timo
                Apr 5 at 12:37














              • 2




                cd .. moves to parent directory, which is not what was the subject of question.
                – ViaSat
                Mar 28 at 16:24










              • This is bash here, not Windows.
                – Timo
                Apr 5 at 12:37








              2




              2




              cd .. moves to parent directory, which is not what was the subject of question.
              – ViaSat
              Mar 28 at 16:24




              cd .. moves to parent directory, which is not what was the subject of question.
              – ViaSat
              Mar 28 at 16:24












              This is bash here, not Windows.
              – Timo
              Apr 5 at 12:37




              This is bash here, not Windows.
              – Timo
              Apr 5 at 12:37










              up vote
              -1
              down vote













              I think cd .. might help. If you do a ls -a in any directory you would see that there are two entries: one named "." and another named ".."; the single dot is reference to the directory you are already in, while the double is the previous directory in the path.






              share|improve this answer

















              • 20




                .. is not the previous directory, it's just the parent directory.
                – Der Hochstapler
                Dec 10 '12 at 10:28






              • 4




                This answer provides useful information even if it does not answer correctly the question. Therefore there is no point in piling negative votes on it, I upvoted for the effort.
                – Titou
                Sep 29 '16 at 12:36








              • 1




                This is not Berkley, there are no special awards just for participation
                – nathanchere
                May 24 '17 at 9:45















              up vote
              -1
              down vote













              I think cd .. might help. If you do a ls -a in any directory you would see that there are two entries: one named "." and another named ".."; the single dot is reference to the directory you are already in, while the double is the previous directory in the path.






              share|improve this answer

















              • 20




                .. is not the previous directory, it's just the parent directory.
                – Der Hochstapler
                Dec 10 '12 at 10:28






              • 4




                This answer provides useful information even if it does not answer correctly the question. Therefore there is no point in piling negative votes on it, I upvoted for the effort.
                – Titou
                Sep 29 '16 at 12:36








              • 1




                This is not Berkley, there are no special awards just for participation
                – nathanchere
                May 24 '17 at 9:45













              up vote
              -1
              down vote










              up vote
              -1
              down vote









              I think cd .. might help. If you do a ls -a in any directory you would see that there are two entries: one named "." and another named ".."; the single dot is reference to the directory you are already in, while the double is the previous directory in the path.






              share|improve this answer












              I think cd .. might help. If you do a ls -a in any directory you would see that there are two entries: one named "." and another named ".."; the single dot is reference to the directory you are already in, while the double is the previous directory in the path.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Dec 10 '12 at 10:08









              Xente

              851




              851








              • 20




                .. is not the previous directory, it's just the parent directory.
                – Der Hochstapler
                Dec 10 '12 at 10:28






              • 4




                This answer provides useful information even if it does not answer correctly the question. Therefore there is no point in piling negative votes on it, I upvoted for the effort.
                – Titou
                Sep 29 '16 at 12:36








              • 1




                This is not Berkley, there are no special awards just for participation
                – nathanchere
                May 24 '17 at 9:45














              • 20




                .. is not the previous directory, it's just the parent directory.
                – Der Hochstapler
                Dec 10 '12 at 10:28






              • 4




                This answer provides useful information even if it does not answer correctly the question. Therefore there is no point in piling negative votes on it, I upvoted for the effort.
                – Titou
                Sep 29 '16 at 12:36








              • 1




                This is not Berkley, there are no special awards just for participation
                – nathanchere
                May 24 '17 at 9:45








              20




              20




              .. is not the previous directory, it's just the parent directory.
              – Der Hochstapler
              Dec 10 '12 at 10:28




              .. is not the previous directory, it's just the parent directory.
              – Der Hochstapler
              Dec 10 '12 at 10:28




              4




              4




              This answer provides useful information even if it does not answer correctly the question. Therefore there is no point in piling negative votes on it, I upvoted for the effort.
              – Titou
              Sep 29 '16 at 12:36






              This answer provides useful information even if it does not answer correctly the question. Therefore there is no point in piling negative votes on it, I upvoted for the effort.
              – Titou
              Sep 29 '16 at 12:36






              1




              1




              This is not Berkley, there are no special awards just for participation
              – nathanchere
              May 24 '17 at 9:45




              This is not Berkley, there are no special awards just for participation
              – nathanchere
              May 24 '17 at 9:45










              up vote
              -1
              down vote













              I find the easiest way to do it is with this .bashrc power edit: https://github.com/wting/autojump .
              You get to "mark" folders you navigate to, giving them a shorthand name that's easy to remember (my advice; the foregoing is not in the docs), such as Pics for Pictures, etc. 'jump' returns you to the folder you 'marked,' and 'marks' lists folders you have added to the 'stack' (as with pushd and popd), with the added advantage that your marks remain the same from one session to the next, ad infinitum.



              I have yet to try it on more than one harddrive, but the results should be similar to those using a single volume.



              S Wright






              share|improve this answer

























                up vote
                -1
                down vote













                I find the easiest way to do it is with this .bashrc power edit: https://github.com/wting/autojump .
                You get to "mark" folders you navigate to, giving them a shorthand name that's easy to remember (my advice; the foregoing is not in the docs), such as Pics for Pictures, etc. 'jump' returns you to the folder you 'marked,' and 'marks' lists folders you have added to the 'stack' (as with pushd and popd), with the added advantage that your marks remain the same from one session to the next, ad infinitum.



                I have yet to try it on more than one harddrive, but the results should be similar to those using a single volume.



                S Wright






                share|improve this answer























                  up vote
                  -1
                  down vote










                  up vote
                  -1
                  down vote









                  I find the easiest way to do it is with this .bashrc power edit: https://github.com/wting/autojump .
                  You get to "mark" folders you navigate to, giving them a shorthand name that's easy to remember (my advice; the foregoing is not in the docs), such as Pics for Pictures, etc. 'jump' returns you to the folder you 'marked,' and 'marks' lists folders you have added to the 'stack' (as with pushd and popd), with the added advantage that your marks remain the same from one session to the next, ad infinitum.



                  I have yet to try it on more than one harddrive, but the results should be similar to those using a single volume.



                  S Wright






                  share|improve this answer












                  I find the easiest way to do it is with this .bashrc power edit: https://github.com/wting/autojump .
                  You get to "mark" folders you navigate to, giving them a shorthand name that's easy to remember (my advice; the foregoing is not in the docs), such as Pics for Pictures, etc. 'jump' returns you to the folder you 'marked,' and 'marks' lists folders you have added to the 'stack' (as with pushd and popd), with the added advantage that your marks remain the same from one session to the next, ad infinitum.



                  I have yet to try it on more than one harddrive, but the results should be similar to those using a single volume.



                  S Wright







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 at 22:51









                  Steve Wright

                  1




                  1






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f113219%2fgo-back-to-previous-directory-in-shell%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      AnyDesk - Fatal Program Failure

                      How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

                      QoS: MAC-Priority for clients behind a repeater