67

I have a folder in my Dropbox and I want to add a shortcut of that folder on my Desktop. I guess this should be extremely easy as in Windows OS :) However, I have no idea how to do it in Ubuntu 14.04.

Is there anything I can do to create a simple folder shortcut on my desktop?

Thufir
  • 4,551
Jim Blum
  • 1,407
  • 4
  • 19
  • 24
  • 4
    You have two option to create shortcut. First right click on folder and hit make link .You can use terminal sudo ln -s (folder path) (where you want to create shortcut) – sohel4r Jun 21 '14 at 18:51
  • thanks a lot @sohel4r. I'll probably use the "make link" option – Jim Blum Jun 21 '14 at 18:52
  • 5
    @sohel4r Why use sudo for a simple link? Also, another option would be to press Ctrl+Shift and drag the folder to the Desktop. – muru Jun 22 '14 at 08:55
  • @muru Well You install apache then you want to link www folder .So What will you use .Think you want to make a link but you have't global permission of that folder .how will you make a link.I am know very poor in Linux.If i am wrong then teach me . – sohel4r Jun 22 '14 at 17:10
  • 4
    @sohel4r Well, he's not making a link in a root-owned folder, but to his own Desktop. Use sudo when you absolutely have to, not when you feel like it. As a sysadmin, I frequently get emails about users who try to use sudo when 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. – muru Jun 22 '14 at 17:17

9 Answers9

109

it simple: just press Ctrl + Shift and drag.

Jakuje
  • 6,605
  • 7
  • 30
  • 37
Shiv
  • 1,091
19

Click on that folder, click on make link, then move the shortcut to Desktop.

16

You can read full details here

man ln

ln -s /usr/bin/bar /opt/foo

also see this link Create a soft or symbolic link

sohel4r
  • 464
  • 1
    That's wrong. That's only for files. You give no explanation and link to a different question. And why would you create a shortcut with a different name than the folder. – Philip Rego Sep 22 '19 at 13:03
  • For Ubuntu 20.04 it works flawless. I used it to create a link in Desktop of an regular User; this link points to a NAS drive folder. It displays the Folder, Name and the North-East purple arrow, in my regular Ubuntu theme. Of course I had to set permissions first. – Marcelo Scofano Diniz May 29 '21 at 15:09
  • thanks. this let me create a shortcut of a folder on linux. – suhailvs Oct 31 '21 at 02:45
6

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 [folder-path].

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 ~/Desktop/[file-name].desktop:

[Desktop Entry]
Name=[folder-name]
Exec=xdg-open [folder-path]
Type=Application
Terminal=false
Icon=[icon-path]

Replacing [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: /usr/share/icons/.

Examples of default Ubuntu folder icons include (but are not limited to):

  • /usr/share/icons/Yaru/48x48/places/folder.png
  • /usr/share/icons/Humanity/places/48/folder.svg
  • /usr/share/icons/HighContrast/48x48/folder.png

For more information on the Desktop Entry Specification please see: https://developer.gnome.org/desktop-entry-spec/

Note that as our file is launching xdg-open it is proper to use the .desktop extension, rather than the .directory extension.

3

Apparently this is handled correctly from the GUI :-) (14.04 LTS)
(Move to Trash, Empty Trash)

But generally: When you have a link to a directory, be VERY sure to delete ONLY the link should/when you come to that point.

From terminal, the correct thing to do is:

rm LINK-TO-DIR


BUT NOT:

rm -r LINK-TO-DIR

... which will first delete the files/dirs that the link MAKES VISIBLE,
and even more so with the "-f" flag.


If you are a "Terminal" user, have a look on the output of

ln --help

... that ls lover case of LN nothing else ;-)

The syntax for it may seem a tad "backwards" at first as you FIRST specify where it should point, then the name of your LINK.

cd $HOME/Desktop
mkdir -p $HOME/z
ln -s $HOME/z New-Link-To-Home-z

... note that the GUI will not notice the new Desktop content without help; you need to logout+login.

More info on the 'net or slightly terse in either of

man ln
info ln

... where I personally prefer the first because 'info' has a tendency to 'slip out of context'.

Hannu
  • 5,374
  • 1
  • 23
  • 40
1

Basically there are two options and both of them work with Ubuntu 22.04 and probably previous releases too,
You can create a link to your Dropbox folder by running this command in terminal

ln -s <path_to_reference_folder> <path_where_you_want_your_link_to_be_placed>

You can also do it through pressing Ctrl+Shift+M after selecting the folder you want a shortcut of, it will create a link to that folder in the reference folder's parent folder, then you can press Ctrl+Shift and drag the link_to_your_folder to desktop or wherever you want that to be placed.

Note: Just doing Ctrl+Shift and drag, as some people suggested here, won't create a shortcut of your folder instead it would move your folder to desktop which you probably don't want to do as this isn't the way shortcuts work in Windows.

Have a Nice Day...!

0

Sorry I'm so late to the conversation but if you are trying to navigate to a folder or run any common command with ease you want to create aliases. First you need to open the alias editor.

sudo nano -Bu ~/.bashrc

go all the way to the bottom of the opened document and add the following

#My aliases
alias aliasname='command you want issued here'

in my editor I added these 2 lines to make it easier to access and edit my aliases.

alias makealias='sudo nano -Bu ~/.bashrc'
alias refreshalias='. ~/.bashrc'

after your aliases have been created issue the refreshalias command I made

. ~/.bashrc

now test your alias by entering your keyword and see if it creates correctly.

Something that surprised me the first time I did this was the fact that 3 common file directory tools taught to me in school ll, la, and l were all aliases of ls extentions in this same tool.

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

as a note to me I also created an aliaslist.txt file on my home with every alias I made with a description after it. Have fun building aliases hope they help you as much as they help me.

0

This works for me -r option to make the shortcut relative to its source. Without it, you may have error as

The link "shortcut-name" is broken

ln -rs /path/to/create/shortcut-name /path/to/the/source
ganiular
  • 111
-1

These below command will create file or folder shortcut in your working directory, in this case it's Desktop/.

cd Desktop/
ln -s /path/to/source/file-or-folder