278

I am working on Ubuntu 12.04 64bit.

I want to add "Open terminal here" to Nautilus context or right-click menu but it tries to download 32bit version from Internet.

landroni
  • 5,941
  • 7
  • 36
  • 58
Sagar Nikam
  • 2,905
  • 3
  • 14
  • 10

12 Answers12

357

You have to install the nautilus-open-terminal package from the universe repositories for Ubuntu versions up to Ubuntu 15.04:

sudo apt-get install nautilus-open-terminal

If you want to install it with apturl, use this URL: apt://nautilus-open-terminal

Then:

nautilus -q  

In order to restart Nautilus

Result

In Ubuntu 15.10, the functionality is already included in nautilus!

air-dex
  • 5,889
  • 1
  • 21
  • 21
  • 2
    I notice that in 13.04 raring ringtail it has disappeared from the "Files" menu and is now only available in the right-click menu. :-( – tudor -Reinstate Monica- May 08 '13 at 02:09
  • 2
    Any idea on how to make it use the normal terminal settings? The terminal it opened didn't have the normal colors and settings. – snapfractalpop Dec 03 '13 at 18:06
  • @snapfractalpop Do you verify that the terminal it opens is the one you expected? There is not one terminal program only on an Ubuntu install (at least gnome-terminal and xterm). – air-dex Dec 04 '13 at 01:57
  • @air-dex It seems to open xterm with the command /usr/bin/xterm -e /bin/sh -c cd '/whatever/folder' && exec $SHELL basically changing directories upon startup of the terminal session. I don't know how to modify this behavior to use xfce4-terminal (which is what I've been using). – snapfractalpop Dec 05 '13 at 00:54
  • @Jobin Nope. The package is still available for 14.04 LTS "Trusty Tahr": http://packages.ubuntu.com/trusty/nautilus-open-terminal – air-dex Apr 23 '14 at 07:30
  • 6
    Works for 14.04 too. – Thorbjørn Ravn Andersen May 01 '14 at 07:26
  • Of course, the one thing I actually want to use this for, opening a samba share in the terminal, doesn't work here. The "open in terminal" is missing. Feels like Louie CK trying to fix his daughter's doll – Nuzzolilo Jan 01 '16 at 20:34
  • I'm in 16.04, and while the menu entry is present, it is about as utterly broken and badly-designed as it could possibly be. Firstly, it's only on a context menu, so there is no keyboard shortcut, not even alt-navigating the pulldowns. Secondly, when I select it, it opens gnome-terminal in my $HOME, not in the selected directory. – Jonathan Hartley Sep 03 '16 at 19:28
  • 8
    In 16.04 there is no nautilus-open-terminal package. Use nautilus-actions instead. – nachtigall Sep 10 '16 at 04:32
  • 1
    Any Ideas on how make it works in 18.04 ? Because none works – Ced Apr 02 '19 at 12:06
  • See https://askubuntu.com/a/1206655/113640 for 2020 answer. – pagliuca Feb 10 '21 at 10:52
43

nautilus-open-terminal and nautilus-actions packages are available in Universe repository of Ubuntu 14.04. So run the below commands to enable universe repository and also to install above mentioned packages.

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install nautilus-open-terminal
sudo apt-get install nautilus-actions

Finally run nautilus -q command to quit nautilus.Now you can be able to see Open in terminal option on right-clicking.

Avinash Raj
  • 78,556
11

Here is my script to open terminal in the current directory,

I built my own after the open-terminal plugin stopped working for me

#!/bin/bash
##################################
# A nautilus script to open gnome-terminal in the current directory
# place in ~/.gnome2/nautilus-scripts
##################################
#                                       Remove file:// from CURRENT_URI
gnome-terminal --working-directory=`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | cut -c 8-`

PS: Here is some bonus info

Assigning a shortcut to the script

  • Add executable script to ~/.gnome2/nautilus-scripts
  • Wait some time - nautilus regenerates accels file
  • Edit file ~/.gnome2/accels/nautilus

  • Find line similar to this one:

; (gtk_accel_path "<Actions>/ScriptsGroup/script_file:\\s\\s\\shome\\sgautam\\s.gnome2\\snautilus-scripts\\sopen-terminal" "")

  • Remove comment (semicolon) and specify shortcut like this:

(gtk_accel_path "<Actions>/ScriptsGroup/script_file:\\s\\s\\shome\\sgautam\\s.gnome2\\snautilus-scripts\\sopen-terminal" "<Primary><Shift>t")

  • Save file.
  • Logout - login.
Gautam
  • 590
8

Just use:

sudo apt-get install nautilus-extension-gnome-terminal 

and Logout/Login or reboot.

5

I have just installed Ubuntu 14.04 Desktop edition today 07-18-2014, and all I had to do to get the command line option in Nautilus was the following in a terminal:

sudo apt-get install nautilus-open-terminal
nautilus -q
bazz
  • 171
  • 1
  • 5
  • 5
    sorry ,how it is different from accepted answer? – Ravan Oct 06 '15 at 01:41
  • IIRC a lot of different solutions were posted, some speaking of different ubuntu versions requiring different methods -- so I posted my experience on my version at the time. – bazz Oct 07 '15 at 03:28
  • I appreciate you-don't mind-this post came on review,that is the only reason I posted the comment – Ravan Oct 07 '15 at 03:32
3

If you are using Ubuntu 18.04 or newer:

sudo apt install nautilus-admin 
Ced
  • 823
  • 4
  • 13
  • 32
  • This is not an addon to open a terminal in the current directory, but to open a nautilus window with root permissions or edit a file with root permissions. The accepted answer is still valid for 18.04. You may want to delete your answer. – vanadium Apr 02 '19 at 14:14
  • 2
    @vanadium The accepted answer does not work for me. This one does as it also add 'open in terminal' when right clicking on folder. – doom Sep 10 '19 at 09:25
  • It might work for you as a workaround, but does not provide a correct answer on the question how to add an open in terminal right-click item. What this answer does is open a dangerous terminal with root permissions. Therefore, I do not consider this a good answer for general use. – vanadium Sep 10 '19 at 10:19
  • 1
    Actually, the right-click menu action now is provided by the package nautilus-extension-gnome-terminal, which in Ubuntu is installed by default – vanadium Sep 10 '19 at 10:24
3

You'll need to install nautilus-admin (make sure to install the additional files) to have the right click option and others as well, since nautilus-open-terminal is no longer maintained.

MiJyn
  • 3,336
1

I used @Gautam's solution until I found it will not work (I mean a script itself) if path contains non-ascii characters because it's URL encoded.

Here is my little fix which is working at least for me. So, the script should look like this:

#!/usr/bin/gnome-terminal

According to gnome-terminal docs, when you execute this:

cd path/to/dir
gnome-terminal

gnome-terminal will use path/to/dir as working directory, which explains why that script works.

user1724911
  • 123
  • 1
  • 6
0
  1. Find the .bashrc file in Home.
  2. Open it with any text editor.
  3. Add a line at the end: cd $PWD
  4. Save it.
  5. Close all instances of Nautilus
  6. Now, when you open Nautilus you will get to see the "Open in terminal" option in the right-click menu and it loads the current directory path when clicked.
0

For recent versions of Ubuntu (eg. 18)... create/save this script in:

~/.local/share/nautilus/scripts/

Note: you need to also chg the permission of this new file to allow execution

It will add a Scripts right click context menu item (with the name given e.g. 'open-in-terminal.sh') for any file or directory you click in nautilus.

#!/bin/bash
#
# When a directory is selected, go there. Otherwise go to current
# directory. If more than one directory is selected, show error.
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
    set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
    if [ $# -eq 1 ]; then
        destination="$1"
        # Go to file's directory if it's a file
        if [ ! -d "$destination" ]; then
            destination="`dirname "$destination"`"
        fi
    else
        zenity --error --title="ERROR! Open terminal here" \
            --text="Plz only select one directory."
        exit 1
    fi
else
    destination="`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's/^file:\/\///'`"
fi

# It's only possible to go to local directories
if [ -n "`echo "$destination" | grep '^[a-zA-Z0-9]\+:'`" ]; then
    zenity --error --title="ERROR! Open terminal here" \
        --text="Sorry, only local directories can be used."
    exit 1
fi

gnome-terminal --working-directory="$destination"

Based on this source: https://help.ubuntu.com/community/NautilusScriptsHowto/SampleScripts#Open_terminal_here

Jay Marm
  • 141
0

Do

sudo apt-get update

and try again.

Or

cd /tmp  
wget http://mirrors.kernel.org/ubuntu/pool/universe/n/nautilus-open-terminal/nautilus-open-terminal_0.20-1_amd64.deb
sudo dpkg -i nautilus*deb
sudo apt-get install -f
hg8
  • 13,462
Naveen
  • 9,365
  • 11
  • 43
  • 70
-2

This link provides the best working solution for adding the feature "Open terminal here" as context command menu for a folder.

http://www.n00bsonubuntu.net/content/add-open-terminal-here-to-file-menu-ubuntu-14-04/