214
43
I currently spend a lot of my working hours moving back and forth between two paths which are very far down the tree and divert from each other at root. It strikes me that my life would be a lot easier if there was an argument for cd
that takes the user to the last directory they were in.
That is, if I'm in:
/etc/foo/bar/baz/moo
and then type:
cd /var/lib/fubarred_app/blargh/logs
I would like to be able to go back to the first directory without having to type the whole path again.
The memory key does not cut it since I use enough commands in each place that it's just as difficult to go back and find the path I want as it is to type it myself.
Is there a short command that would just let me go to the previous directory?
See also http://superuser.com/questions/113219/go-back-to-previous-directory-in-shell
– jiggunjer – 2015-05-16T18:43:55.4308
in addition to @bryan's excellent answer, you might consider creating a pair of aliases for each path so you can just type something like: "
– warren – 2011-08-17T20:30:53.243bazmoo
" or "blarghlog
" at the prompt :)4
Why don't you just use GNU screen?
– Shi – 2011-08-17T20:43:28.9832Which shell? that makes a huge difference. – Randal Schwartz – 2011-08-18T02:22:40.300
@warren ditto. that's my preferred way to do everything. half of what i use my computer for has its own alias now... =) – ixtmixilix – 2011-08-19T15:58:13.437
Fasd is awesome. Check it out. – majkinetor – 2013-11-05T08:58:42.893