1. Overview

Similar to desktop shortcuts for frequently used programs, it’s also possible to have desktop shortcuts for our favorite sites. This enables us to quickly access those sites by just clicking the shortcuts. There are multiple ways to create shortcuts for URLs in Linux. In this article, we’ll explore some methods for creating URL shortcuts to quickly access our favorite sites.

All shortcuts we create with these methods will open in the default browser. If we want to open the URL in a different browser, we can easily change the default browser in Linux, just as we could on other operating systems.

2. Through Drag and Drop From Browser

A quick way we can use to create a shortcut for a URL is to use our browser’s drag-and-drop feature. Firefox and some releases of Chrome support this feature.

Let’s start by creating a URL shortcut directly from our browser. First, we launch the browser and navigate to the website we want to create a shortcut for. Once the site is open, we drag the icon (usually the padlock icon) beside the address bar of the site out of the browser and drop it onto the desktop:

This creates a shortcut on our desktop. To visit the URL, we simply need to double-click the shortcut, and it’ll open in our default browser.

Similarly, we can create multiple shortcuts for different sites as needed. Moreover, we can also move the shortcut to another directory.

3. Through an HTML File

Another simple yet effective method to create a URL shortcut is through an HTML file. By using a text editor like Nano, we can easily create an HTML file for a specific URL.

Let’s create a .html file using the Nano text editor:

$ nano test.html

Next, we add the following line to the file:

<meta http-equiv="refresh" content="0; url=www.google.com"/>

It’s important to note that the URL in the example above, https://www.google.com, serves as a placeholder. We just need to replace the URL with the link we want to open with this shortcut. Now, we save and close the file. This creates a test.html file in the current terminal directory. We can also move this file to another directory or the desktop for easy access.

After the HTML file is created, it’s ready to be used as a shortcut for the specified URL. Whenever we need to access the specific URL, we can simply double-click the shortcut.

4. Through Browser’s Menu

Some browsers, including Google Chrome and Chromium, also allow the creation of a shortcut for a URL from their menu. In this method, we’ll create a desktop shortcut for a web page from the browser’s menu.

First, we open the webpage in the browser for which we want to create the shortcut. Next, we click the three vertical dots icon in the top right corner of the browser to open up a menu.

The next step differs slightly in both browsers. In Chrome Browser, we hover the mouse over “More tools” to open up a sub-menu. From there, we click on “Create shortcut”:



While in Chromium, we go to “Save and share” and then click on “Create shortcut”:



The next step is the same for both browsers. A dialog box appears. We type a name for the shortcut and click “Create”. By default, the URL opens in an existing browser window. To open the URL in a separate window, we can check the box named “Open as window”:



After doing so, we’ll notice the URL shortcut with its logo on our desktop:


5. Through a .desktop File

In this method, we’ll create the shortcut for a URL through a .desktop file. To do this, we’ll first create a .desktop file using the Nano editor. For this example, we’ll name this file baeldung.desktop:

$ nano baeldung.desktop

Now, let’s add the following lines of code in the file:


Exec=xdg-open https://www.baeldung.com/linux/


After that, we save and close the file.

This creates a shortcut for the URL. Next, we move this shortcut to the desktop using the mv command:

$ mv baeldung.desktop ~/Desktop/baeldung.desktop

To use the shortcut, we’ll need to first make it executable by right-clicking it and selecting “Allow launching”:



Once done, the URL shortcut is ready for use. By double-clicking the shortcut, our default web browser will open and directly navigate to the specified URL. It’s important to note that for each new shortcut we want to create, we’ll need to repeat these steps, making sure to replace the URL in the .desktop file with the desired one each time.

6. Conclusion

In this article, we’ve explored several methods for creating URL shortcuts in a Linux environment for accessing a site instantly. Now, instead of opening a browser and looking for a favorite site, we can just click a shortcut to access it right away.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.