Nautilus is the file manager for the GNOME desktop. How do I open Nautilus from the Linux or Unix shell prompt to open files and directories on a Linux or Unix based desktop?

You can use the gnome-open command to open files and URLs using the GNOME file handler, ust as if you had double-clicked the file’s icon. If the file is in the form of a URL, the file will be opened as a URL. If you are using KDE or other desktop try:

xdg-open command ## generic version ##[donotprint]

Tutorial details
Difficulty level Easy
Root privileges No
Requirements Terminal
Est. reading time 1m
[/donotprint]

OR

kde-open command ## kde ##

OR

open command ## osx ##

Examples

For example, if you were in the /home/vivek directory, typing the following command would open the file manager:

gnome-open .

Sample outputs:

Fig.01: gnome-open in action

The . (dot) is your current directory. If you type two dots ( .. ) it would open the parent directory:

gnome-open ..

To open a directory in Nautilus, enter:

## home dir ##
gnome-open ~
 
## /tmp ##
gnome-open /tmp

To open a web page or url:
gnome-open www.cyberciti.biz
To open an document file
gnome-open resume.odf
To open a pdf file:
gnome-open lsst.pdf
To Send an e-mail:
gnome-open mailto:foo@cyberciti.biz
To open an URL:
gnome-open 'http://www.cyberciti.biz'

A note about KDE and other *nix desktop users

You can use kde-open or xdg-open to open a file, directory or URL in the user's preferred application. The syntax is same:

kde-open .
xdg-open .
kde-open 'www.cyberciti.biz' 
xdg-open 'www.cyberciti.biz

You can also use kfmclient under KDE desktop for opening URLs from the command line. To opens the current directory:

kfmclient exec .

To open the file:

kfmclient exec file:/home/vivek/test.html

To opens the file with firefox:

 kfmclient exec file:/var/www/html/docs.en.html Firefox

To open new window with URL:

kfmclient exec ftp://ftp.cyberciti.biz/
kfmclient exec http://www.cyberciti.biz/

Putting it all together

You can use the following bash for loop examples to open 5 random pages from Wikipedia:

for J in {1..5} 
do 
  xdg-open http://www.wikipedia.org/wiki/Special:Random
done
## OS X specific example ##
for J in {1..5} 
do 
  open http://www.wikipedia.org/wiki/Special:Random
done

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Rahul May 18, 2012 @ 5:15

    Hi thanks for sharing this.
    I am getting this error:

    rahul@linux-cyyh:~> gnome-open www.cyberciti.biz
    Error showing url: Error stating file '/home/rahul/www.cyberciti.biz': No such file or directory
     

    Please help to solve this.

    Thanks again :)

    • Jacob Degeling May 13, 2015 @ 6:22

      Try prepending http:// to the URL and putting it in quotes

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum