1

I'm quite a newbe. I was wandering: is it possible to see the last paths used in terminal (bash, whatever.., I use a Mac), something like what you do with recent commands?

I often use the terminal on the same paths (generally the same project) for several days. To me, it's quite annoying to search for the same path every morning when I open the terminal.

  • Or http://unix.stackexchange.com/q/157763/70524, depending on how you look at it – muru Apr 29 '16 at 07:46
  • You could add an alias wich prints out the needed path. Or you could add an alias for a complete command with which uses the appropriate path. – mnille Apr 29 '16 at 07:48
  • 1
    strart by 1) up-arrow -- to go back in history; 2) CTR-R to interactive search in history; – JJoao Apr 29 '16 at 08:29

2 Answers2

2

If you have history set up, you can use

history | grep cd

to see your recent cd commands.  You should be able to use them to figure out where you were working last time.

0

So you want to change into a certain directory each time you open a shell? In this case you can add the cd command to your ~/.bashrc (or the appropriate rc file for your shell if you don't use bash).

Another approach would be to create an alias in ~/.bash_aliases, e. g.

alias pd='cd /my/project/dir'

and enter pd each time you want to get there.

Murphy
  • 2,649