1

Coming from Mac OS, in terminal I am able to use open . in terminal which will open a directory.

I am able to semi replicate this with pantheon-files ., but this returns

[INFO 21:33:37.889767] Application.vala:155: Files version: 0.2.4
[INFO 21:33:37.889846] Application.vala:157: Kernel version: 3.19.0-33-generic
[WARNING 21:33:37.894015] Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-0hpFTi9zyT: Connection refused
[INFO 21:33:37.930317] Application.vala:85: Report any issues/bugs you might find to http://bugs.launchpad.net/pantheon-files

To get round the above issue I use pantheon-files . > /dev/null. However, the command is still running in my terminal session and when I close it in terminal it closes the window I have just opened.

My question, can I open a directory from terminal without leaving the session open?

6
  • what do you mean "without leaving the session open"?
    – Ravan
    Commented Nov 19, 2015 at 21:54
  • btw the message is common, but not an error: =)
    – Ravan
    Commented Nov 19, 2015 at 22:01
  • @Ravan: I used the word session in the sense of pantheon-files running. If that makes sense. So, to continue to use terminal after running the command I would need to hit ctrl + c. Commented Nov 20, 2015 at 12:52
  • Well, see @DanielFore answer, hope it solve :)
    – Ravan
    Commented Nov 20, 2015 at 12:53
  • I am sure still you need to use Ctrl+c to use terminal after running the command even after using xdg-open . Isn't it?
    – Ravan
    Commented Nov 20, 2015 at 14:00

4 Answers 4

5

It looks like xdg-open . is what you're looking for. I'm able to close Terminal without quitting Files.

The other Terminal output can be ignored

1
  • Cheer Daniel. I have managed to do the following to replicate the functionality. Commented Nov 20, 2015 at 12:54
3

To detcach a program from a terminal simply run the command with a & at the end like this:

pantheon-files . &

Then simply press Ctrl + D and the terminal will close, leaving the program running.

This works for anything - even when xdg-open does not.

1

To open file/folder from terminal:

  1. pantheon-files /path

    Example: pantheon-files /home/ravan/Downloads

  2. xdg-open /path

    Example: xdg-open /home/ravan/Downloads

EDIT 1:

. (dot) represents the current working directory;

.. (dot dot) represent the directory one level above the current working directory, often referred to as the parent directory.

EDIT 2: To clarify comment-

To use terminal after running the command xdg-open /path :

Run the command instead of the previous one:

xdg-open /path ; sleep 1

Here it will be xdg-open . ; sleep 1

To close terminal automatically:

xdg-open /path ; exit

Here it would be : xdg-open . ; exit

0

I've created a bash alias to use the xdg-open . command like the MacOs open . ignoring the command output. You can place the alias at your .bash_profile to make it persistent.

alias open='xdg-open &> /dev/null'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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