19

How do I configure Nautilus to open at my Documents folder instead of my home folder?

I've scoured this site and found answers instructing users to edit the /usr/share/applications/nautilus.desktop file, replacing %U with the path to the desired default directory. I've edited all the variants of nautilus.desktop in the said directory, but none of the edits has an effect. I've checked all the files after editing them to make sure that I saved the edit effectively, and all look good to me.

I've edited every file to read as follows:

Exec=nautilus --new-window /home/judy/Documents

I've also edited the org.gnome.Nautilus.desktop file, just to be sure, with no joy.

I'm running Ubuntu 15.10.

Note: if I enter nautilus /home/judy/Documents from the command line, Nautilus properly opens in the desired directory. Is there a simple way that I can configure an icon in the launcher bar to run this command and have the Nautilus icon that looks like a metal file drawer?

Thanks. I'm pulling my hair out over this one.

7
  • 1
    Did you try a restart after making these changes?
    – user364819
    Dec 6, 2015 at 19:12
  • Also, if you just run nautilus --new-window /home/judy/Documents in Terminal does it work as desired?
    – user364819
    Dec 6, 2015 at 19:13
  • To my surprise, the way it used to work doesn' t anymore. WIll remove my answer, will post back if I find out why. Dec 6, 2015 at 20:46
  • Thanks for the advice. I've edited the original nautilus desktop files in /usr/share/applications back to their default state. I've copied the org.gnome.Nautilus.desktop file into my ~/.local/share/applications directory and used gedit to edit its Exec line. I've rebooted. I've run the source ~/.profile command. Sadly, still no joy. When I start nautilus from the launcher bar, it still starts in my home directory instead of in my documents directory.
    – trinkner
    Dec 6, 2015 at 21:10
  • Here is the contents of the file:[Desktop Entry] Name=Files Comment=Access and organize files Keywords=folder;manager;explore;disk;filesystem; Exec=nautilus --new-window /home/judy/Documents Icon=system-file-manager Terminal=false Type=Application DBusActivatable=true StartupNotify=true Categories=GNOME;GTK;Utility;Core;FileManager; MimeType=inode/directory;application/x-gnome-saved-search; X-GNOME-Bugzilla-Bugzilla=GNOME X-GNOME-Bugzilla-Product=nautilus X-GNOME-Bugzilla-Component=general X-GNOME-Bugzilla-Version=3.14.2 etc... the web site doesn't let me add more chars.
    – trinkner
    Dec 6, 2015 at 21:13

5 Answers 5

6

Here is what worked for me on a vanilla Ubuntu 20.04:

(Worth noting that while on the UI the app is called "Files", under the hood it's still referred to as nautilus.)

  1. Copy the right launcher to the right location:

    /usr/share/applications/org.gnome.Nautilus.desktop
    

    to

    /home/<YOURUSERNAME>/.local/share/applications/
    
  2. Make the copy executable, either with:

    chmod +x /home/<YOURUSERNAME>/.local/share/applications/org.gnome.Nautilus.desktop
    

    or by right-clicking the icon → PropertiesPermissions tab → checkbox Allow executing file as program.

  3. Edit the copy:

    • There are two lines that start with Exec=. Edit both lines so they look like this:

      Exec=nautilus --new-window /your/desired/directory
      

      Note that I removed the %U from the end of the line.

    • Deal with the DBusActivatable entry (thanks L31N).

      Either assign a false value to it, or comment out the line, like this:

      # DBusActivatable=true
      

      I don't know know about any side effects of this latter step, I hope it's gonna be fine in the long run.

  4. Either reboot or just log out of the session and log back in.

For me now it opens my directory both when called via the dash and when clicked in the dock.

3
  • That was helpful. In my case I don't use launcher, but have keys assigned like in windows explorer (Windows+E). Only thing I had to do, was edit key combination command adding desired folder. Thanks
    – qba-dev
    Jun 30, 2021 at 6:58
  • 2
    There is no need to make the .desktop file executable: Step 2 can be removed.
    – vanadium
    Dec 25, 2021 at 17:42
  • To avoid needing to logout, instead make the initial copy to ~, and then edit the file, and then install it using desktop-file-install --delete-original --dir="$HOME/.local/share/applications/" ~/org.gnome.Nautilus.desktop. It will appear in your start menu immediately. This has the added benefit that (I think) this step will validate the file as it installs it. Jan 21, 2023 at 14:30
5

The file that is shown in unity-dash is not anymore /usr/share/applications/nautilus.desktop but /usr/share/applications/org.gnome.Nautilus.desktop.

Changing the Exec= line in the file itself does not have any effect. The problem is an entry DBusActivatable=true that makes the system to run nautilus via dbus. So the Exec= line is being ignored. Maybe it is possible to provide nautilus the desired directory through dbus (/usr/share/dbus-1/services/org.gnome.Nautilus.service) but I am not familiar with that system in detail.
For further information look here: https://wiki.gnome.org/HowDoI/DBusApplicationLaunching

A simple solution for me was to hide the gnome/dbus launcher-icon and make the old one visible again. So add the entry NotShowIn=Unity; to /org.gnome.Nautilus.desktop and comment it out in nautilus.desktop. There you can adjust the Exec= line with the desired directory.

(file: org.gnome.Nautilus.desktop)

[Desktop Entry]
NotShowIn=Unity;     # <--------------------------- add this line !
Name=files
Comment=Access and organize files
Keywords=folder;manager;explore;disk;filesystem;
Exec=nautilus --new-window %U
Icon=system-file-manager
Terminal=false
Type=Application
DBusActivatable=true
StartupNotify=true
Categories=GNOME;GTK;Utility;Core;FileManager;
MimeType=inode/directory;application/x-gnome-saved-search;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.14.2
X-GNOME-UsesNotifications=true
Actions=Window;
X-Unity-IconBackgroundColor=#af4853
X-Ubuntu-Gettext-Domain=nautilus

#OnlyShowIn=Unity;    # <---------------- comment out this line !

[Desktop Action Window]
Name=Open a New Window
Exec=nautilus --new-window
#OnlyShowIn=Unity;    # <---------------- comment out this line !

(file nautilus.desktop)

[Desktop Entry]
#NotShowIn=Unity;     # <---------------- comment out this line !
Name=files
Comment=Access and organize files
Keywords=folder;manager;explore;disk;filesystem;
Exec=nautilus --new-window /{DESIRED_DIRECTORY}     # <- adjust !
Icon=system-file-manager
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;Core;FileManager;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.14.2
X-GNOME-UsesNotifications=true
Actions=Window;
X-Unity-IconBackgroundColor=#af4853
X-Ubuntu-Gettext-Domain=nautilus

[Desktop Action Window]
Name=Open a New Window
Exec=nautilus --new-window
4
  • 2
    @techraf Still no joy after editing the files. I'm confused why there are so many nautilus configuration files. What does each do? My system has usr/share/applications/nautilus.desktop, usr/share/applications/nautilus-home.desktop, and usr/share/applications/nautilus-classic.desktop and usr/share/applications/nautilus-autorun-software.desktop, and usr/share/applications/nautilus-connect-server.desktop and usr/share/applications/nautilus-folder-handler.desktop and usr/share/applications/org.gnome.Nautilus.desktop
    – trinkner
    Apr 3, 2016 at 21:03
  • @trinkner I do not know for what each file exactly is, but these are different launcher-icons for different uses. nautilus-home.desktop e.g. is used for the home-icon in the launcher (open it and look at the comment). You can also create new icons for specific locations. You only have to copy nautilus.desktop and replace %U with the directory. To find it in the dash you have to make sure that there is no entry NotShowIn=Unity.
    – L31N
    Apr 4, 2016 at 20:35
  • 1
    I succeeded in getting Nautilus to open to my desired folder by making the edits suggested by @techraf. But after the edits, Nautilus continued to open at the default /home/user directory when launched from a pinned launcher bar icon. To solve this, I renamed EVERY nautilus .desktop file in /usr/share/applications by appending .backup to the file name. I appended .backup to the org.gnome.Nautilus.desktop file name. The one file I did not rename was nautilus.desktop, which I edited as suggested by @techraf. Now the launcher icon correctly opens in my desired folder.
    – trinkner
    Apr 5, 2016 at 18:44
  • 1
    That didn't work either. I'm on ubuntu 18 LTS. This whole thing has been ridiculous. I've tried 30 different things, but I still can't click on a desktop folder and open it. It's amazing to watch time go on and technology regress into uselessness. I thought opening inode/directories was a solved problem. Maybe I'll wait till the next LTS. Jun 8, 2018 at 0:46
3

This is what worked for me on Ubuntu 22.10 with the somewhat new nautilus from gnome 43.

This is the original file.

[Desktop Entry]
Name=Files
Comment=Access and organize files
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=folder;manager;explore;disk;filesystem;nautilus;
Exec=nautilus --new-window %U
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=org.gnome.Nautilus
Terminal=false
Type=Application
DBusActivatable=true
StartupNotify=true
Categories=GNOME;GTK;Utility;Core;FileManager;
MimeType=inode/directory;application/x-7z-compressed;application/x-7z-compressed-tar;application/x-bzip;application/x-bzip-compressed-tar;application/x-compress;application/x-compressed-tar;application/x-cpio;application/x-gzip;application/x-lha;application/x-lzip;application/x-lzip-compressed-tar;application/x-lzma;application/x-lzma-compressed-tar;application/x-tar;application/x-tarz;application/x-xar;application/x-xz;application/x-xz-compressed-tar;application/zip;application/gzip;application/bzip2;application/vnd.rar;
X-GNOME-UsesNotifications=true
Actions=new-window;
X-Unity-IconBackgroundColor=#af4853
X-Ubuntu-Gettext-Domain=nautilus

[Desktop Action new-window]
Name=New Window
Exec=nautilus --new-window
  1. copy this to user config

cp -rv /usr/share/applications/org.gnome.Nautilus.desktop ~/.local/share/applications

chmod +x ~/.local/share/applications

  1. Enter text editor.
[Desktop Entry]
Exec=nautilus --new-window %U
# DBusActivatable=true
[Desktop Action new-window]
Exec=nautilus --new-window /path/to/your/preferred/directory
  1. Restart or logout.
1

Trying to make this work for a while now. After a lot of frustration, stumbled on something that worked for me:

  • changed all the "Exec" commands in all the files that start with "nautilus"

    Exec=nautilus-autorun-software /home/user/Desktop

  • deleted all existing "Files" icons from my Desktop and /home/user/.local/share/applications folder (had quiet a few of them due to past tries to solve this issue that did not work)

  • changed 3 lines in /usr/share/applications/org.gnome.Nautilus.desktop:

    Exec=nautilus --new-window /home/user/Desktop DBusActivatable=false ... Exec=nautilus --new-window /home/john/Desktop/repos

Note: the Exec command apear twice in org.gnome.Nautilus.desktop! one time at the very last line. changed both.

  • restarted the computer

  • started files from activities (Activities -> Type here to search... -> "Files") and it worked.

I added the Files icon to favorites (with right click -> add to favorites) and it opens the correct folder every time.

This is my org.gnome.Nautilus.desktop file after the change:

   [Desktop Entry]
   Name=Files
   Comment=Access and organize files
   # Translators: Search terms to find this application. Do NOT translate or 
   localize the semicolons! The list MUST also end with a semicolon!
   Keywords=folder;manager;explore;disk;filesystem;
   Exec=nautilus --new-window /home/user/Desktop
   # Translators: Do NOT translate or transliterate this text (this is an icon 
   file name)!
   Icon=org.gnome.Nautilus
   Terminal=false
   Type=Application
   DBusActivatable=false
   StartupNotify=true
   Categories=GNOME;GTK;Utility;Core;FileManager;
   MimeType=inode/directory;application/x-7z-compressed;application/x-7z- 
   compressed-tar;application/x-bzip;application/x-bzip-compressed-tar;a$
   X-GNOME-UsesNotifications=true
   Actions=new-window;
   X-Unity-IconBackgroundColor=#af4853
   X-Ubuntu-Gettext-Domain=nautilus

   OnlyShowIn=Unity;GNOME;

   [Desktop Action new-window]
   Name=New Window
   Exec=nautilus --new-window /home/user/Desktop/repos

Hope it will help.

-1

There is a simpler way:

  • Create an empty file in your desktop.

  • Open it with a text editor, such as gedit.

  • Write the following lines:

    [Desktop Entry]
    Name="Open Nautilus in custom folder"
    Exec="nautilus /path/to/custom/folder"
    Type=Application
    

Save it as nautilus_custom.desktop. Open a terminal and run:

chmod +x $HOME/Desktop/nautilus_custom.desktop

Without quotes. Now you should be able to start Nautilus in you custom folder by double-clicking the file you've just created in your desktop.

1
  • Sorry, but this is really bad. Never have multiple .desktop files represent the same application in their main command. It will mess up the presence of nautilus in the launcher. Dec 6, 2015 at 19:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .