.url files are Internet Explorer shortcut created on Windows desktops. Linux counterparts are .desktop files. No idea about Mac, yet. The solution below is suitable for you if double-clicking the .url opens in Firefox serves your purpose. I’m hardcore fan of Firefox despite its annoying and degrading performance each day.
.URL Windows shortcut file looks like this:
[InternetShortcut]
URL=https://saidulhassan.com/?p=1029
.DESKTOP linux shortcut files like this:
[Desktop Entry]
Encoding=UTF-8\nIcon=text-html
Type=Link
Name=RFI
URL=https://saidulhassan.com/?p=1029
Now, if you’re like me, recently moved from windows to linux (Mint 17.1 Cinnamon in my case) and now wondering how to directly open all those internet shortcuts without writing/using complex bash scripts or manually edit each files in text editors to match the conventions as shown above- there is an Easter egg solution!
Are you familiar with Thunar File Manager? My distro came with Nemo. Ubuntu comes with Nautilus. If you are using any ubuntu derivatives, simply install it sudo apt-get install thunar
. Don’t worry, it’s just a one-off task which means you can uninstall Thunar once our purpose is done. But I use Thunar’s bulk renaming features and thats why I’m keeping it. Another good complementary tool for bach renaming is pyRenamer. They both have their unique features and I use both, but thats a different topic and I will share that in another post.
So here is the steps:
STEP 1: Open Thunar file browser >> Right-click a .url file >> Select: “Open With” >> “Open With Other Application” >> Select/Click on “Use a custom command”. A text entry field will appear.
STEP 2. Copy/paste the following custom command to the text entry field:
bash -c “cat %f | grep URL | cut -d’=’ -f2 | xargs firefox &”
STEP 3. Click the default checkbox, then press Open. Your URL will now open in Firefox.
To make .url files work in Nemo/Nautilus, do absolutely nothing. Thunar already did all the filetype association work, so Nemo/Nautilus should now open .url files in Firefox. No extra steps required!
You can now uninstall Thunar if you wish.
Source: Trogdor from www.xfce.org
Resources:
01. Long version using bash scripts, creating dektop shortcuts etc. most of which goes over my head. http://steronius.blogspot.com/2013/01/open-url-files-in-linux.html
02.Firefox addon that works on both Windows and linux to create internet shortcuts accordingly- SaveLink by prudnik https://addons.mozilla.org/en-us/firefox/addon/savelink/