0

In Windows, there is the Run prompt, which you can access with Win+R key.

run

What is the equivalency to this in Linux? Is there even such a thing or is the Terminal the main prompt you would use in Linux for the type of tasks you normally use the Run prompt for in Windows?

Here is a use case. I want to access \\192.168.0.103\ on my home network. On Windows, I can use the Run prompt for this. Like so:

run2

Where do you type in UNC paths and how do you access them on Linux? What do I have to consider if the remote is a Windows based computer? Do I have to spend a day or two configuring things or will it just work out of the box? You know... SMB, Samba and all that.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Samir
  • 816
  • 2
  • 11
  • 22

2 Answers2

5

This depends on which desktop environment you are using.

In GNOME, KDE, Unity and Xfce the default keyboard shortcut for the run prompt is Alt + F2.

As jofel pointed out, xdg-open is a desktop-independent tool for opening a file or URL in a preferred application. Inside a desktop environment, xdg-open simply passes the arguments to a desktop environment specific equivalent (gvfs-open in GNOME and Unity, kde-open in KDE or exo-open in Xfce).

While the desktop environments might not support UNC paths, they generally do understand URIs. Since in this case you want to access a Windows SMB share, the corresponding URI scheme is smb, yielding an URI like smb://192.168.0.103.

Generally you should be able to pass an URI like this to xdg-open, either in the run prompt or in a shell running in a terminal emulator, and have xdg-open open the specified URI in the preferred application associated with the particular URI scheme:

xdg-open smb://192.168.0.103

In the case of GNOME, which is the default desktop environment in Debian, this would, by default, be the Nautilus file manager. Unfortunately it seems that there is a possible bug with xdg-open, which prevents the opening of SMB shares, unless they have been mounted beforehand. This should be handled by the Gnome Virtual File System (GVFS) automatically, but for some reason it might not work with xdg-open.

As a workaround, you could pass the URI directly to nautilus in the Run prompt (or shell). Alternatively you could open the SMB share via the Connect to server dialog in Nautilus (File > Connect to Server) or type the smb URI in the Location bar (Go > Location or triggered via the keyboard shortcut Ctrl+L).

Thomas Nyman
  • 29,912
  • 10
  • 65
  • 77
  • I think it's Gnome. It's Debian 7.1.0 Wheezy, the default environment I think. – Samir Sep 30 '13 at 09:31
  • It works! I see a "Run Application" dialog box. But unfortunately accessing UNC paths is not as simple as typing in `\\192.168.0.103` and hitting Enter, like on Windows. If I do that, it says "could not open location". Should I post this as a separate question? – Samir Sep 30 '13 at 09:36
  • If you're using gnome, UNC paths probably won't work, but you can try running `xdg-open` giving the destination URI as argument. – Thomas Nyman Sep 30 '13 at 09:41
  • Yeah, `smb://192.168.0.102` didn't work. Is says "could not open location" and "file doesn't exist". It's the same with `cifs:\\192.168.0.103` as suggested by @jofel except it now says "the specified location is not supported". – Samir Sep 30 '13 at 09:46
  • So you mean like `xdg-open smb:\\192.168.0.103` and I type that in the Run Application prompt? Or the Terminal?... – Samir Sep 30 '13 at 09:47
  • Well I tried the Run prompt first, the dialog box just closes (as it's supposed to) when I hit Enter but there is no response. Not even an error. While in Terminal I get a response like "the specified location is not supported" and so and so forth. I tried variations, like cifs instead of smb, and only typing the UNC and only the IP, nothing works. I will have to post this as a separate question. – Samir Sep 30 '13 at 09:54
  • You have your slashes and backslashes mixed up. URIs have slashes (`/`). You also cannot omit the protocol part as that is used by `xdg-open` to determine the preferred application to launch. – Thomas Nyman Sep 30 '13 at 10:31
  • Ah! You noticed that! Thanks! So it would be `xdg-open smb:\\192.168.0.103` then? There is no space between semicolon and backslash? – Samir Sep 30 '13 at 10:39
  • Exactly the opposite: `xdg-open smb://192.168.0.103`. No space between semicolon and backslash. – Thomas Nyman Sep 30 '13 at 10:40
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/10822/discussion-between-sammy-and-thomas-nyman) – Samir Sep 30 '13 at 10:44
  • I think [Xfce](http://www.xfce.org/) defaults to binding Alt+F2 to this, too. I'm pretty sure xfrun4 only accepts proper commands, though (that's all I use it for). – user Sep 30 '13 at 11:26
1

Under most window managers you get a similar prompt by pressing Alt + F2.

It depends on your environment, if you can enter UNC/URLs/paths or only real commands which start a program (in this case you can use xdg-open as the program and give it the URL/path as a parameter).

Instead of SMB UNC you probably need to use URLs like cifs://SERVER/PATH or smb://SERVER/PATH.

jofel
  • 26,513
  • 6
  • 65
  • 92
  • If you are interested in earning some more points, you can head over to the new question [here](http://unix.stackexchange.com/questions/92959/how-do-i-access-my-windows-administrative-share-from-linux). – Samir Sep 30 '13 at 10:15