Whenever a new tab is opened in urxvt, the cwd(current working directory) is the default directory set in bashrc.
How to make the new tab to be opened at the cwd of the current tab?
rxvt
Whenever a new tab is opened in urxvt, the cwd(current working directory) is the default directory set in bashrc.
How to make the new tab to be opened at the cwd of the current tab?
Best Answer
First, you could override the
cd
builtin with a function that stores the current directory every time you change a directory.Then, you could change to this last known directory in every new shell you open:
If you place both these snippets in your
~/.bashrc
, every new shell you open with have the overriddencd
command and will try to change to the last known directory:Note that I used the
command
builtin to gain access to the originalcd
command instead of the function namedcd()
. Also note that doing this will probably have unintended side effects, especially when you have multiple shells open at the same time (which is kind of the whole point of usingurxvt
tabs).