161

I want to place a link/shortcut/launcher in my unity panel (ubuntu 12.10).

I followed this tutorial on handytutorial.com to create a custom launcher and drag it to the panel.

I just need to know which command do I have to input. Is this possible?

3
  • What are you trying to launch?
    – catalesia
    Mar 8, 2013 at 20:51
  • I think he is trying to add an URL as launcher. Midori used to have this, maybe I'll check it out again.
    – userDepth
    Jun 6, 2016 at 19:58
  • for ubuntu 20, xdg-open . works well. Aug 8, 2021 at 19:36

7 Answers 7

176

gnome-open does not work for me on 12.04 but nautilus /path to open does work.

example: nautilus /home/john/Downloads.

10
  • Weird... I'm on 12.04 right now. gnome-open works for me. Are you using Lubuntu? Or Xubuntu? Mar 8, 2013 at 20:14
  • 27
    Try xdg-open instead
    – elias
    Mar 8, 2013 at 21:00
  • 3
    @oaskamay I found out why I have gnome-open. I installed gnu-cash, which installed libgnome2-bin (gnome-open is in it) as one of its dependencies. Mar 8, 2013 at 21:17
  • 2
    Works on 18.04, too. Jun 13, 2018 at 8:36
  • 4
    For ubuntu 20.04, need to use xdg-open instead, because I can't find a way to install gnome-open any more, and xdg-open is installed by default.
    – Eric
    Jun 29, 2020 at 11:35
117

If the question is how to open a file/folder, the answer is always xdg-open.

From man xdg-open:

xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.

In this specific case the commmand

xdg-open folder

opens folder in your default file manager, be it Nautilus, Dolphin, Thunar or anything else.

5
  • Actually I think most applications will behave normally and open a file/url/binary being it the default file type to handle. Eg: blender untitled.blend
    – userDepth
    Jun 6, 2016 at 19:56
  • This tool has been deprecated, use 'gio open' instead.
    – ktec
    Oct 29, 2017 at 12:22
  • as of 2020 it is not deprecated
    – vampiire
    May 31, 2020 at 4:34
  • 2
    I'm on Ubuntu 20.10 and can confirm that it still works. I find it more convenient than nautilus since it starts the process and let it alone.
    – Amani
    Apr 15, 2021 at 13:46
  • this still works on Fedora 37 2023.
    – Rami
    Mar 26, 2023 at 19:38
19

A shortcut to open a folder? If this what you want, the command is:

gnome-open </path/to/folder>

For example: gnome-open /home/Tiago/Downloads.

If it isn't installed run sudo apt-get install libgnome2-bin.

2
  • works for me on Ubuntu 15.05 Dec 31, 2015 at 22:27
  • Also works on Ubuntu 16.04 GNOME Flashback.
    – chus
    May 3, 2018 at 7:19
16

Use the command nautilus <path>.

So for example: nautilus /home/oaskamay will open up my home (~) folder.

In addition, if you need to open-up the GUI with root permissions, run gksu nautilus <path>. It works with every GUI front-ends too (e.g. gksu gedit /etc/default/grub).

It's important to note that you should never start GUI apps like so sudo gedit /etc/default/grub.

0
10

xdg-open works for me on ubuntu 16.04. I only made a copy of this command as open:

sudo cp /usr/bin/xdg-open /usr/bin/open
sudo chmod 775 /usr/bin/open

Now you can use it just like on mac os:

open ./
3
  • This might answer the question title, but I fail to see how this lines up with the question.
    – anonymous2
    Jun 6, 2016 at 19:39
  • Answering the question title seems more important, I found this answer while searching for what was asked in the title. A pity it's just a copy of another answer on the same question, given 3 years earlier...
    – user723790
    Jan 12, 2018 at 10:08
  • 1
    At Ubuntu 22.04 is enough use open <path/to/directory> as macOS Feb 23, 2023 at 20:56
1

You can make a simple alias named as "open" or "o" etc... in .bashrc

sudo nano ~/.bashrc

# add personaly open alias
alias open='xdg-open ./'

log out account, sign in, open the terminal and write open

-1

Use Midori's app function. When I make an app this way it is added to launchers.

enter image description here

enter image description here

1
  • Create a new file with a name of you choice: sudo nano /usr/local/bin/myCommand . Paste the following command there: nautilus $PWD Once you have written the code for your command, save and close the file. sudo chmod +x /usr/local/bin/mycommand. Test your new command: Add your command to the PATH (If you want to be able to execute your command from any directory, you need to add it to the PATH environment variable): export PATH=$PATH:/usr/local/bin to your .bashrc file. Restart your terminal or run source ~/.bashrc
    – Ali
    Mar 11, 2023 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .