I want to rename a file in GUI. I know I can either RightClick > Rename OR press F2, but I know in Chrome OS you can just type Ctrl+Enter in the Files app, and it will do that.

Is anything similar to this possible in Ubuntu? Is there any keyboard shortcut other than F2 that will allow one to rename a file in GUI?

Or, if not, then is there a way for me to set a custom keyboard shortcut for this as Ctrl+Enter, like in Chrome OS? I know currently trying Ctrl+Enter will only do the same thing as just typing Enter.


  • Make & Model: Dell Inspiron N5010
  • Operating System: Ubuntu 15.04
  • File Manager1: Files [the default one included in Unity]
  • GUI Environment2: Unity

1 I don't even think this matters, does it?

2 Is it redundant to say "GUI Environment"?


3 Answers 3


I'm using Gnome instead of Unity, but they should be the same (more or less).

Nautilus (a.k.a. Files) keeps its keyboard shortcuts in ~/.config/nautilus/accels

File Rename is listed there as:

; (gtk_accel_path "<Actions>/DirViewActions/Rename" "F2")

The ; means that it is commented out and Nautilus uses the system default.

If you remove the ; and change the line to:

(gtk_accel_path "<Actions>/DirViewActions/Rename" "<Primary>Return")

Then File Rename will be changed to Control-Enter.

It seems that there is only one shortcut possible for each operation. Nautilus uses the last one listed.
So you can't have F2 and Control-Enter at the same time.

In order for the changes to take effect you have to stop nautilus. Run the following from the commandline (before you make the change):

nautilus -q

Detailed steps (on request):

  • open Files ('Nautilus')

  • browse to directory .config/nautilus in your home directory

  • if you don't see directories starting with a dot, press <Ctrl>H or in the preferences for Files ('Nautilus'), tick the box for displaying hidden files.

  • right-click or double-click file accels so that it opens in an editor (likely gedit)

  • Alternatively, hit <Alt>F2 and give command: gedit ~/.config/nautilus/accels

Now we have the configuration file in an editor, we have to stop Files ('Nautilus') before we can make changes. Again, two ways of doing this:

  • Option 1: open a terminal window (Gnome Terminal) and kill nautilus, by issuing command: nautilus -q. Your Files window(s) should all disappear
  • Option 2: hit <Alt>F2 and give command nautilus -q. Your Files window(s) should all disappear

Now Files ('Nautilus') has been stopped, we can make changes to its configuration files.

  • In the editor, make the changes as listed above and save the file
  • Exit the editor

If you now open Files ('Nautilus') again, your changes should take effect

Answers to foot notes:

  1. It is relevant to specify the application you're having a problem with. In this case, it was the configuration of the application as opposed to a system setting that had to be modified to resolve this issue.
  2. People will know what you mean by GUI Environment. It is however generally referred to as GUI or Desktop in this context.
  • By the way, a few questions: (1) What do you mean by "commented out"? Nov 12, 2015 at 17:27
  • (2) What does <primary> mean? Nothing comes up if I search for that on Wikipedia. Nov 12, 2015 at 17:28
  • (3) Damn, it'd be nice to have both F2 and Ctrl+Enter. Still, it's just as nice to even just have Ctrl+Enter! :D Nov 12, 2015 at 17:28
  • 1
    @SarahofGaia See amended instructions in the post.
    – NZD
    Nov 20, 2015 at 19:43
  • 1
    @SarahofGaia In 'colloquial speech' they are often used interchangeable. E.g. someone could ask you what GUI you are using and you could say that you are using the Gnome desktop of the XFCE desktop. Also see this UL post
    – NZD
    Nov 25, 2015 at 6:30

ALT+Enter worked for me in the File Navigator, but then you have to use ESC to close.


Similar to Bring BackSpace back to nautilus (3.18+) once and for all!. We can use the same fix for Ubuntu 18.04+ (Nautilus 3.26+) to set the shortcut keys for rename.

1) Install Nautilus Python

apt-get install python-nautilus

2) Download Backspace-Back.py from Nautilus-backspace and put it in ~/.local/share/nautilus-python/extensions:

mkdir ~/.local/share/nautilus-python
mkdir ~/.local/share/nautilus-python/extensions
wget https://raw.githubusercontent.com/riclc/nautilus_backspace/master/BackspaceBack.py ~/.local/share/nautilus-python/extensions/BackspaceBack.py

3) Make a copy of the file (or rename) for the purposes of making a new shortcut (or put it all in that one file).

cp BackspaceBack.py Rename.py

4) Edit Rename.py and modify the line in the file that starts with app.set_accels_for_action to the following:

app.set_accels_for_action( "view.rename", ["<control>Return"] )
app.set_accels_for_action( "view.open-item-new-tab", [] )

5) Restart Nautilus (killall nautilus)

Note that "open-item-new-tab" also has to be modified to free up the Control+Return key combination and then reassign it to "rename".

You can use this to change any shortcut in Nautilus. The complete list of current shortcuts and their defaults can be pulled from the source code for Nautilus (search for nautilus_application_set_accelerator).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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