Wednesday, February 12, 2014

How to make a shortcut in Linux shell?

Making shortcuts in Linux command line is rather easy. Nevertheless, it is a somewhat more tricky than making shortcuts in Windows, as we are not provided with the GUI (Context menu).

You should use ln -s command to make a Linux shortuct using command line. The -s parameter is necessary in order to create a symbolic link (shortcut), instead a hard link (reference).

The basic syntax is here:
ln-s source target


source - absolute path to the original file
target - absolute path to the shortcut which is to be created

An example of creating Eclipse shortcut on user ubuntu's desktop:

ln -s /home/ubuntu/kepler/eclipse /home/ubuntu/Desktop/eclipse

Using absolute paths is highly recommended, as relative paths can easily lead to confusion if the target and source are not in the same directory.

One more thing, if you are making a symbolic link to an executable, make sure it has a permission to be executed as an executable.

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...