42

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?

10

13 Answers 13

30

From https://askubuntu.com/a/207448/371765

Run 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.

3
  • 5
    This should be the correct answer: simple, direct, solves the problem and the program/plugin is already available in Ubuntu repos. Apr 9 '15 at 14:26
  • I recall installing a gnome scripts package some time ago that added this functionality along with others like some "convert to ..." and etc. It was quite the learning experience and it led me to write a script to convert a directory of videos to .webm format (to conserve space). I beleive I found the package of which I speak at g-scripts.sourceforge.net
    – Elder Geek
    Apr 12 '15 at 13:06
  • 4
    package "nautilus-open-terminal" (doesn't exist anymore with that name at least). Jun 5 '19 at 19:35
11

With Dolphin Install dolphin, KDE's file manager, you have two options:

  1. Open a terminal as a panel in the same window. Use the keyboard shortcut F4 or the menu: ControlPanelsTerminal.

    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!

    enter image description here

    In this screenshot you even see the sweetness of having this as a toolbar item in the top.

  2. 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.

4
  • What does "connect the current directory" mean? (Sorry, I am not very knowledgeable about KDE 4.) Apr 8 '15 at 23:26
  • 1
    @EliahKagan I was referring to the feature of the first option in which the terminal follows path changes in the panel above and vice versa. The 'cd' commands seen in my screen shot aren't typed by me, but performed by browsing in the file manager.
    – gertvdijk
    Apr 8 '15 at 23:27
  • "synchronized" would be a better word here Apr 9 '15 at 21:08
  • @glennjackman Thanks, indeed. Edited my answer accordingly.
    – gertvdijk
    Apr 9 '15 at 22:58
11
+50

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

Original Post

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

enter image description here

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' .

9
  • Can you tell me which file manager does that?
    – Saad
    Mar 28 '15 at 1:32
  • To be honest, this, IMO, is rather a workaround. I'm not even sure if it's actually more convenient than typing cd <path>.
    – kos
    Mar 28 '15 at 1:33
  • Nemo, gnome-commander, I think thunar does as well, but dont quote me on that one Mar 28 '15 at 1:34
  • @kos well, it's the best that can be done with nautilus without the plugin, so . . . Mar 28 '15 at 1:35
  • Not to criticize, don't get me wrong, and I'm not even saying there's a better way. Maybe the right answer it's just "You can't, unless you change your file manager".
    – kos
    Mar 28 '15 at 1:38
5

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".

4

No extra installation required simply right click inside the directory and take

open in terminal

I am using ubuntu 16.04

2

comes within nautilus in 15.04 by default.

1
2

If you mean opening a new terminal in a new window, with the same location as the previously opened terminal.

Then, Ctrl+Shift+N does the work for me.

I am on Ubuntu 17.04.

Thank you.

2
  • it also work on Ubuntu 16.04 May 4 '18 at 2:51
  • 1
    Ctrl+Shift+N is used to create a new folder. Atleast on Ubunutu 18.04 LTS
    – radio_head
    Aug 6 '19 at 6:57
2

The 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

nautilus -q

and restart by opening any folder.

0
1

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):

Fire up 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 true.

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.

0

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.

0

You can easily open terminal for current file path by right clicking on the folder. At the right click menu there will be an option for Open in Terminal. This option will open the terminal for the current directory.

0

For Ubuntu 20 just install nautilus-actions.

-2

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 terminal here

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

3

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.