I am new to Ubuntu, and was wondering whether it is posible to open a terminal with a path matching your current location in the file manager? In Windows it was very easy, but how do you do it in Linux?
sudo apt-get install nautilus-open-terminal in a terminal, followed by
nautilus -q to quit all open nautilus windows. When nautilus is next opened, a line saying
open in terminal should appear in the right click menu.
Please note that the package
nautilus-open-terminal is in the universe repositories.
With Dolphin , KDE's file manager, you have two options:
Open a terminal as a panel in the same window. Use the keyboard shortcut F4 or the menu: Control → Panels → Terminal.
The working directory is synchronized between the two panels; changing directories in either of the two panels will also change it in the other. Sweet!
In this screenshot you even see the sweetness of having this as a toolbar item in the top.
Open a terminal in a new window. Use Shift+F4 to do that. It will not have the feature to have the working directory synchronized, but it just opens a new window with the current working directory set.
The same applies to other apps in KDE Plasma, like the Kate text editor (enable it in Kate's settings, it's a built-in plug-in). Opening a terminal with a single keyboard shortcut from your text editor with the context of the file, is simply brilliant.
Update , April 11
Create a simple script
opendirectory.sh with the following contents
#!/bin/sh # set -x OPENDIR=$(zenity --entry --text="Type or paste address");gnome-terminal --working-directory="$OPENDIR" &
Bind that script to a shortcut , for instance Ctrl+Alt +i, or whatever you like.
Now, when you are in some directory in nautilus, press Ctrl+L to open address bar. Copy the address of your current directory with Ctrl+X.
Lauch the shortcut you just created and paste the address with Ctrl+V in to the dialog. Terminal should pop-up with the directory that you told the dialog to open.
IMHO, this is as "native" as it gets and doesn't require additional installation. Sure, it is not a right click type of thing, but it works and can be implemented quickly. Will work for other file managers that don't support this option,too
Technically nautilus, the default file manager, doesnt have
open terminal here option, but there is a plug in for that in the repositories. You might be more interested in other file managers that support this option out of the box
As a workaround you could try the following:
Ctrl+L willopen the text filed for entering address, with the current working directory highlighted. Cut that out with CtrlX, and paste into terminal with CtrlShiftV or right click. Alternative , use run dialog to launch
gnome-terminal --working-directory= and paste whatever you copied after = sign.
Drag and drop: Drag the button/tab (not sure how it's called) into terminal, add cd in front
Another way: Open the file manager and terminal. Drag and drop the folder you want to access into terminal, and add
cd to the path.
For instance, if I want to access
bin directory in my
/home/serg/ directory, i would drag that directory to terminal and it would appear as
'/home/serg/bin'. Next, add
cd, so that the whole line is
cd '/home/serg/bin' .
Here is a small overview about the three file managers I know:
The file manager Nemo (part of the Cinnamon DE) has a built-in context menu option to both "Open as root" and "Open in a terminal".
The file manager Thunar (part of the Xubuntu/XFCE DE) even provides a feature to simply create user defined tasks that appear in the context menu. As an example, there is "Open a terminal here" included. I added an "Open as root" for directories myself. You can specify the command to execute, which parameters to give it and on which kinds of files/directories to show it.
I can expand my answer and add a more detailed explanation on how to create a custom context menu entry in Thunar. Please leave me a comment if anybody is interested.
The file manager Nautilus (part of the Unity DE, default for normal Ubuntu) provides neither of the two features built in nor the possibility to create custom context menu entries. However, there exists an additionally installable package to extend Nautilus' capabilities to open a folder in a terminal (see the answer of @ethanbmnz).
PS: I know that "Open as root" was not a feature requested by the OP, but I think it's related and not less useful than "Open in a terminal".
nautilus-open-terminal package doesn't seem to be available for recent versions of Ubuntu, as noted in the similar question linked in the accepted answer.
This answer to that same question works for me in Ubuntu 20.04. Install
nautilus-extension-gnome-terminal by running
sudo apt install nautilus-extension-gnome-terminal
and then quit Nautilus with
and restart by opening any folder.
I understand that an answer is already provided and accepted, but I stumbled across this from my Ubuntu MATE configuration using the
caja file manager, and naturally, couldn't readily apply any of these solutions.
So for those of you who may be looking for a way to do this in
Caja on the
MATE Desktop, here's something that may work (it worked for me):
dconf-editor from your start menu (or alternatively, from the terminal). Navigate to
org.mate.interface and observe a checkbox with description "Can Change Accels". Mark that box as
Now fire up
caja your favorite way. Go to the alt-menu at the top, look under "Files", and spot the option "Open in terminal" as always. Except this time, gently move your mouse (or keyboard scope) over to that option, and press a button combination (I like to use
Ctrl-Alt-H meaning "open terminal HERE"). Now you should see that button combination on the drop-down menu, and should be able to use it. Note that you shouldn't set it to an existing combo such as the default
Ctrl-Alt-T to open a terminal at your
~ directory. This method will not override existing combos.
Hope this helps.
Another solution with a script:
#!/bin/bash xfce4-terminal --working-directory="$(xclip -o)"
I assign one shortkey to this script (in my case, F4).
When I am in a directory in my file manager, I press CTRL+L to highlight the directory path, and after that I press F4 (the key I chose above to open the terminal). This is a another way of using the PC without taking the hands off your keyboard.
Instead of xfce4-terminal, you can use gnome-terminal.
It is a really simple matter to deal with. You can simply install nautilus open terminal package and if you install it , then you can simply open terminal from any folder/director you wish just by right clicking and clicking on
open terminal here.
To install it
all you want to do is to install it by opening a terminal, hope you know how.
Then type this command and press enter :
sudo apt-get install nautilus-open-terminal
After installing go to a folder and try it. Just open home folder and right click >> Then select Open
or you have another choices to install other file manager and in some of them there is the function to open terminal here on right click menu. Nemo has it. Good luck