24

I can navigate my files quite fast through terminal. Faster than double clicking... open... look, double click... etc.

How do I open a directory in the Ubuntu GUI? For example:

cd projects
{some cmd} client_project

Then voila, it opens in the Ubuntu GUI as if i navigated manually?

Also, how can I open a URL in my default browser via terminal. It'd be awesome to go: F12

open http://google.com

And Chrome opens it up.

39

To Open Directory:

  • To open a Folder from terminal type the following,

    nautilus /path/to/that/folder
    

    or

    xdg-open /path/to/the/folder
    

    i.e

    nautilus /home/karthick/Music
    xdg-open /home/karthick/Music
    
  • Simply typing nautilus will take you file browser,

    nautilus
    

To Open URL:

  • You can type any one of the following in terminal,

    xdg-open http://google.com       
    google-chrome http://google.com                 
    opera http://google.com
    firefox http://google.com
    
  • If you want to open two URL's at the same time then leave some space after the first URL and type the second,

    firefox www.google.com www.gmail.com
    

Note:

  • Linux is case-sensitive, so type the file name correctly.
  • You can also add an alias to short the command,for example if you need openurl instead of x-www-browser you should edit the .bashrc file
    gedit ~/.bashrc
  • In the bottom of the file add the following lines

    alias openurl=x-www-browser
    

    alt text

  • Save and close the file.
  • Now you can open URLs by typing,

    openurl http://google.com
    
  • 3
    xdg-open works for directrories and other files, too – Florian Diesch Dec 12 '10 at 13:33
  • @FlorianDiesch forgot to include that,thanks for remembering :) – karthick87 Dec 12 '10 at 13:37
  • 1
    It's worth pointing out more gernerally that xdg-open should have the same result as clicking on any file in a folder or on your desktop. It should open your file/folder/url with the default application to handle that file type. I have it aliased as go in my ~/.bashrc – andrewsomething Dec 12 '10 at 18:59
  • Awesome, thanks a lot. I installed Komodo and it set up komodo somefile.html to open files but i didn't see it in the bashrc file. Where else could it be and could I change it to edit somefile.html but opens in Komodo as if i typed komodo? – Oscar Godson Dec 12 '10 at 21:39
  • Well, there's already a /usr/bin/edit, so I'd choose something else, but anyways... In ~/.bashrc add a line that says alias edit='komodo' – andrewsomething Dec 12 '10 at 22:43
6

Instead of typing all the quotes etc. one could use:

nautilus .

Works with directories containing spaces in their names.

2

You can just call the aplication. Both Nautilus and Chrome accept path (url) as parameter.

nautilus /directory/subdirectory/subsubdirectory

or

cd /directory/subdirectory/subsubdirectory and then nautilus . (the dot is important -- it says to Nautilus to open the current directory)

google-chrome www.google.com

or

x-www-browser www.google.com -- this command calls the browser set as default (so if your default browser is Chrome, it will open Chrome)

1

Nope, the above answers are OK, but this is what I think you are looking for:

nautilus "$(pwd)"

xdg-open "$(pwd)"

I was just experimenting today, and it worked. Isn't it fabulous?

1

To open a directory/ folder

You can use, nautilus . and press enter to open the current directory.

To open path specified location try the following.

E.g. If you want to open Music folder under this location:

/media/dulithdecozta/A08A64BB8A648F98/Music/

Then execute the following.

nautilus /media/dulithdecozta/A08A64BB8A648F98/Music/

To open a URL via the terminal

E.g. Lets open stackoverflow.com via terminal

(Google Chrome)

google-chrome http://stackoverflow.com 

(Firefox)

firefox http://stackoverflow.com 
0

The easy way is to paste the url file in the address box of Firefox, at least, haven't tried other browsers, and when you hit enter Firefox shows the real address of the url. Paste that in the address box. Works for me

0

Open Directory:

  • To open a Directory or Folder from terminal.

    nautilus /home/user/path_to_folder/ &
    

    Or

    xdg-open /home/user/path_to_folder/ &
    

    The ampersand & is used; so the process get start into the background and we can continue to use the shell or terminal without waiting for script to get finished.

    Note: For better result use absolute path.

Open URL

  • Type any one of the following in terminal.

    opera http://www.google.com &
    firefox http://www.google.com &
    xdg-open http://www.google.com &
    

To close directory, URL, etc.:

  • Onto the Folder/URL or any screen window, type Ctrl + w

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.