1

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

  • what is the 0S?? – UnKNOWn Apr 6 at 18:27
  • @PRATAP sorry I forgot. edited – fedeUbuntu Apr 6 at 18:30
  • i think you can create another terminal app in your local directory and bind ctrl alt T to open that..so your right click menu will not interfer that.. – UnKNOWn Apr 6 at 18:30
  • @PRATAP can you explain? i don't know how to do it, i'm pretty new in Ubuntu – fedeUbuntu Apr 6 at 18:33
  • 1
    Hi I just did this way.. bash -c 'gnome-terminal --working-directory=$HOME/Music' and binded it to keyboard shortcut.. i.stack.imgur.com/gajGu.jpg – UnKNOWn Apr 6 at 18:46
1

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:

gnome-terminal -w /path/to/folder

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

gnome-terminal -e  NameOfFileManager
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.