Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

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.

share|improve this question

marked as duplicate by karel, minerz029, BuZZ-dEE, Jorge Castro, Lucio Feb 14 at 16:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
See this askubuntu.com/a/252752/69051 –  TheKojuEffect Feb 13 at 1:48

2 Answers 2

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.

share|improve this answer
    
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. –  Glutanimate Feb 13 at 1:36

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?

share|improve this answer

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