Question

We can open Nautilus with given directory in Terminal like:

nautilus /home/jeeeyul/workspace

However, I want to open "/home/jeeeyul" and select "workspace" and reveal it rather than open "workspace" directory. Can I do this from Terminal?

Was it helpful?

Solution

Nautilus can open the parent folder of workspace, but includes no option to control selection.

The only possible option I can think of is xdotool, which can emulate mouse and keyboard events within a window.

For mouse, if you can predict where the workspace icon or list item will be located within the Nautilus window, you can open the window with specific dimensions using --geometry, then use xdotool to cause a mouse click at that location. If you have trouble predicting the location, you can perhaps rename workspace to something that will appear at the top of a list, and have Nautilus sort items by name ... then rename it back after the click.

Keyboard might be a better option. You could use xdotool to send keyboard commands and/or type things in the Nautilus window that would force the selection. You'd need to experiment as to how. (I don't know what version of Nautilus you're using, or what other files might be in that folder.)

These solutions are hardly ideal. With any luck, someone else with more in-depth knowledge of Gnome will post something exceeding clever.

OTHER TIPS

I do not know if this was recently added but you can open a folder's parent and select it using the following method:

nautilus -s /home/jeeeyul/workspace

This will open nautilus in the /home/jeeeyul/ path and with the workspace folder selected.

Just wanted to add this in case anyone else was still searching for a solution.

Yes, you can do this using terminal. After you start terminal, you have to switch user you can use sudo -i for switch as root user and then use nautilus.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top