I wasn't able to file a reliable solution from the other provided answers. As such, I'm sharing my preferred approach to creating a desktop shortcut.
Desktop shortcuts can be added by creating a file with the .desktop extension in the
~/Desktop/ folder using any text editor. The .desktop file we create shall launch the folder viewer app
xdg-open at the location specified by
Though it's not necessary, it is of course sensible to name the file similarly to the folder name.
The following information should be written to
[folder-name] with the name of the folder and
[folder-path] with the location of the folder.
Please Note: If the location or name of the folder changes then the .desktop entry will require to be edited.
Once the file has been created it shall appear on the desktop. Right click it and click
Allow Launching to activate the .desktop file as an application.
You can replace
[icon-path] with an image of your choice; Default Ubuntu icons are located at:
Examples of default Ubuntu folder icons include (but are not limited to):
For more information on the Desktop Entry Specification please see:
Note that as our file is launching
xdg-open it is proper to use the .desktop extension, rather than the .directory extension.
sudofor a simple link? Also, another option would be to press Ctrl+Shift and drag the folder to the Desktop.
sudowhen it is absolutely unnecessary, like the case you made just now. The right way to go about accessing folders of servers (like
/var/www/is to add yourself to the server's group (
www-data, in this case), and make the folder group-writable.