I know how to open directory, but I do not know how to select a file from the command line.
I do not know how it works, but when I move any file to a directory and then open the directory that this file is selected.
I think it's actually easier than it seems. What I tried is just this:
At first, the file doesn't look to be selected, but that's just because the nautilus window isn't active. If you click on it, you'll see that the file name is selected.
Since I guess you want to have that extra visual feedback, I used
What you should see is that nautilus in opened with using
Note: in this example if sleep is set to a shorter time you might not get the expected result since you need the window to be properly displayed before trying to activate it.
I don't think there's an option to do this. See:
You can open a file as if you had double clicked it in nautilus using the xdg-open command:
If you really wanted to have this specific feature, it would require hacking on the Nautilus code.
When you in an xterm, navigating directories on the command line, and then want to pop up a nautilus window for that directory, do this:
The gnome-open command will open a directory with the appropriate application, which in this case is Nautilus:
This will open the directory /tmp using the Nautilus file browser.
I like the gnome-open command because you can use this exact same command to open a file with the appropriate application. No need to remember any funny flags. It just works.