2

I currently use nautilus as my default file manager. When I search for some file or folder, I also need to switch to the directory that contains the particular file or folder. It feels tedious to go to the properties then copy the path and open the same path. How can I save time, could there be some shortcut to switch to the directory that contains the file (or folder) being looked upon.

1

2 Answers 2

0

I don't know about any inbuilt function that could achieve this, but you could use a simple Nautilus script:

#!/bin/bash

nautilus "$(dirname "$1")"

In fact, you could even direct Nautilus to the file right away and it would still open the parent directory:

#!/bin/bash

nautilus "$1"

With this script Nautilus will also highlight the file within the directory.

See here for more information on installing Nautilus scripts:

How can I install a Nautilus script?

You could then proceed to set up a shortcut for the script. I'd advise you skip step 2 and 4 of that answer as they don't appear to be necessary. If you named your script something like "Open parent directory" it should be easy to find it in the accels file and change the hotkey. The line should look something like this:

(gtk_accel_path "<Actions>/ScriptsGroup/script_file:\\s\\s\\shome\\sshivshnkr\\s.gnome2\\snautilus-scripts\\sOpen%20parent" "F4")

In this case the shortcut would be F4.

1
  • Because I see that this answer is getting downvoted: You are free to vote without any comment but I'd appreciate it if you could tell me what's wrong so that I can improve my answer. Feb 13, 2014 at 1:36
0

What method are you using to search? I tried "Search for Files" in Nautilus just now, and when I right click one of the search results, there's an "Open Containing Folder" option that launches the file's folder in Nautilus (with the file highlighted). Is this what you want? If not, what's missing?

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