Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I create a keyboard shortcut so that when I press F12 in nautilus (or desktop), I get a terminal in the current directory?

share|improve this question
An added tip, don't use sudo on dconf-editor, run it without. Found that out the hard way, spent a few minutes rebooting and restarting before I figured it out. – Velocity Drift Mar 18 '14 at 9:38
up vote 43 down vote accepted

Finally figured it out.. first sudo apt-get install dconf-tools nautilus-open-terminal, then run dconf-editor and set the org/gnome/desktop/interface/can-change-accels boolean on. Then open nautilus using this command (to disable Unity global menu Temporarily):

nautilus -q

Now you can mouseover the action in the file menu, and change the accel by typing your key while the action is highlighted, finally restart your nautilus. If you don't see Open in terminal in the File menu and you've just installed nautilus-open-terminal, you might need to first run nautilus -q.

enter image description here

enter image description here

Ubuntu 14.04 and up

If you can't find the can-change-accels key in your dconf configuration you can try the following solution:

  1. Stop nautilus by executing nautilus -q
  2. Open ~/.config/nautilus/accels in a text editor of your choice, e.g. gedit:

    gedit ~/.config/nautilus/accels
  3. Try to see if you can find the following line:

    ;(gtk_accel_path "<Actions>/DirViewActions/OpenInTerminal" "")
  4. If the line exists, add your keyboard shortcut in the second double-quoted segment and uncomment the line by removing ;:

    (gtk_accel_path "<Actions>/DirViewActions/OpenInTerminal" "F12")

    This would set the shortcut to F12. For a list of all possible key codes please consult this answer.

    If the line doesn't exist just copy and paste the one found in this answer at the end of the file.

  5. Save the file and restart Nautilus by clicking on the Nautilus icon in your launcher/dash.

Ubuntu 15.10

In Ubuntu 15.10, the relevant command in ~/.config/nautilus/accels is TerminalNautilus:OpenFolderLocal. (NautilusOpenTerminal::open_terminal is still present in the file, but doesn't seem to have any effect.) So follow the instructions above, except change the line

; (gtk_accel_path "<Actions>/ExtensionsMenuGroup/TerminalNautilus:OpenFolderLocal" "")


(gtk_accel_path "<Actions>/ExtensionsMenuGroup/TerminalNautilus:OpenFolderLocal" "F12")

to make F12 your keyboard shortcut.

share|improve this answer
this helped a lot, thanks – Ege Özcan Feb 9 '12 at 15:18
The trick with F12 key doesn't work for me :( – Radu Rădeanu May 30 '13 at 9:52
As indicated in the answer, use dconf-editor. Using gconf-editor may not help. – Kadir Sep 1 '13 at 5:06
Not working for me on Ubuntu 14.04 – Deepen Apr 29 '14 at 5:34
@DpN For 14.04 try editing in the file ~/.config/nautilus/accels and adding a line like (gtk_accel_path "<Actions>/DirViewActions/OpenInTerminal" "F12"), then restart nautilus. – wim Apr 29 '14 at 9:04

Using the dconf-editor approach doesn't seem to work in Trusty Gnome. But the following does:

In your home directory press Ctrl+h, open the .config folder, the nautilus folder, and the accels file;

ie, open ~/.config/nautilus/accels and change the line:

; (gtk_accel_path "<Actions>/ExtensionsMenuGroup/NautilusOpenTerminal::open_terminal" "")


(gtk_accel_path "<Actions>/ExtensionsMenuGroup/NautilusOpenTerminal::open_terminal" "F12")

Note that the comment delimiter has been removed.

Save the file, log out and back in.

share|improve this answer
Yep, this is the approach I have already suggested in the comment on accepted answer. – wim May 7 '14 at 14:09
This approach works perfectly – Hasan Mar 29 '15 at 15:43
There is no need to log out and in again. A simple nautilus -q does the job. – adn Apr 20 '15 at 14:31

You could also use a nautilus script instead of a dedicated extension:

#!/usr/bin/perl -w
# Open terminal here
# Nautilus script that opens a gnome-terminal at the current location, if it's
# a valid one. This could be done in shell script, but I love Perl!.
# 20020930 -- Javier Donaire <>
# Licensed under the GPL v2+
# Modified by: Dexter Ang []
# 2003-12-08: Modified for Gnome 2.4
#       - Added checking if executed on Desktop "x-nautilus-desktop:///"
#         so that it opens in /home/{user}/Desktop

use strict;

if ($_ and m#^file:///#) {
  exec "gnome-terminal --working-directory='$_'";

# Added 2003-12-08 Dexter Ang
if ($_ == "x-nautilus-desktop:///") {
  $_ = $ENV{'HOME'};
  $_ = $_.'/Desktop';
  exec "gnome-terminal --working-directory='$_'";

Instructions on installing the script and assigning a keyboard shortcut.

share|improve this answer
And how exactly having a Nautilus script instead of a dedicated extension helps assigning it a keyboard shortcut? – MestreLion May 30 '14 at 8:58
@MestreLion Thank your for your comment. This answer was merged from another Q&A (check the edit log for more details). That's why it didn't have a section on assigning a shortcut. – Glutanimate May 30 '14 at 13:06
Ohh, I see. Sorry then! A bit unfortunate that such distinct (albeit related) questions were merged. Your answer was great for the other question, but incomplete for this one. – MestreLion Jun 1 '14 at 12:50

To expand on John F. Healy's post:

nautilus -q
sudo apt-get install nautilus-open-terminal
sed -i 's/; (gtk_accel_path "<Actions>\/ExtensionsMenuGroup\/NautilusOpenTerminal::open_terminal" "")/(gtk_accel_path "<Actions>\/ExtensionsMenuGroup\/NautilusOpenTerminal::open_terminal" "F12")/g' ~/.config/nautilus/accels

This should work on Ubuntu 14.10 Utopic Unicorn. The last line edits the ~/.config/nautilus/accels file. To make sure the edit was successful, try the following command:

grep NautilusOpenTerminal::open_terminal ~/.config/nautilus/accels
share|improve this answer

After installing nautilus-open-terminal, ensure that you have killed all nautilus processes (there's always one non visible nautilus process running, so use pgrep nautilus to find them and use then use the kill command).

Then if you launch nautilus, you should see the Open in Terminal if you right-click in the list of files, like I did in the screenshot below (where I was running 14.04):

enter image description here

share|improve this answer
The problem is I use list view where there is no white space left if the folder contains many files. Now I use tree in list view in the display setting as a temporary solution. – xgdgsc Apr 10 '14 at 11:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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