OS: Ubuntu 19.10.
I use Nautilus as file manager, and I modified ~/.bashrc
file to open the terminal in another directory rather than Home
. Let's call the target directory $(MYDIR)
. Now, the problem is that if I press Right Click -> Open in Terminal
in Nautilus, it opens the terminal in $(MYDIR)
, and that's because I think it executes the line of code I wrote in ~/.bashrc
.
Is there a way to fix this? I would like to open $(MYDIR)
with ctrl-alt-t
, but I would also like to open any directory from Nautilus when I do Open in Terminal
.
Can I have both?
I think I could do it by adding some code in ~/.bashrc
wrapping the line cd $(MYDIR)
but I don't know how to do it.
Any kind of help would be appreciated. Thank you
There's no need to edit bashrc, or other system settings, you can just create a shortcut for whatever you need and assign a key combination for it.
Go to Desktop Settings (depends what desktop environment you use) find keyboard shortcuts there you should see a list of already assigned commands in your system and you should see an option to add the custom shortcut.
For example I want my terminal to open with a specific directory, then add this command as a shortcut:
And assign the key combination let's say Ctrl+Alt+H and save it, now when you press it, it'll launch terminal with that directory.
Or you can use
-e
option to launch File Manager GUI