When I work in terminal, sometimes I want to open the current directory in a GUI file manager. And then to click the items in the window to run the application. How can I do this?
-
2I don't think this question is an exact duplicate. There are [many similar questions](http://askubuntu.com/search?page=1&tab=relevance&q=xdg-open) with some identical answers but none of the questions have the exact same focus as this question. The closest question is [How to open a directory/folder and a URL through Terminal](http://askubuntu.com/q/17062/667) – dv3500ea Mar 19 '11 at 14:52
-
Tried all the answers below. The ones that worked on Ubuntu 20.04 are: `xdg-open .`, `nautilus .`, `browse .`. But `gnome-open .` did not work as-is (I guess either gnome is not installed or there's some other reason for that). Nonethless, this is to confirm what worked as of 01-Feb-2022. – CypherX Feb 01 '22 at 10:19
6 Answers
The following works in all desktop environments by using the default file manager:
xdg-open .
You can also open files from the terminal as if you had double clicked them in the file manager:
xdg-open file
- 36,816
- 13
- 99
- 152
-
1
-
-
-
-
1
-
-
This shows a deprecation warning, the newer command is `gio open .` (Centos 7) – vulpxn Jul 13 '20 at 03:29
-
Is there a similar command to "Choose a file"? e.g. It will open the default file manager and you can choose/select a file and it'll return the file's absolute path? More like a "File-picker"? – zean_7 Jun 18 '21 at 13:38
Problem
This tip will explain How to open a file manager of the current directory in the terminal
Solution 1
The following works in all desktop environments by using the default file manager:
xdg-open .
Solution 2
You can also open files from the terminal as if you had double clicked them in the file manager:
xdg-open file
Solution 3
If you are using Gnome, you can use the gnome-open command, like so:
gnome-open .
Solution 4
You can use nautilus [path]. for current directory -
nautilus .
- 41,392
- 18
- 84
- 133
-
This is the most complete one and should be the answer. Works in RedHat 7.2 x64. – WesternGun Nov 10 '16 at 20:35
You write nautilus [path]. for current directory -
nautilus .
- 615
- 1
- 5
- 13
-
This has the disadvantage that you have to keep terminal window alive while you are navigating. If you kill the window, the file explorer gets killed too. – gdaras Oct 23 '18 at 15:22
-
3This is easily solved by adding `&` to the end like this: `nautilus . &` – Vladislav Rastrusny Mar 08 '19 at 14:31
-
In Ubuntu 20.04, you can just say browse . to open the current directory
- 560
- 1
- 6
- 16
-
`browse` is just a symlink to `xdg-open`. So you can use both of them in the same way. (i.e you can also open files with `browse`) – Asocia Apr 13 '21 at 09:47
If you are using GNOME, you can use the gnome-open command, like so:
gnome-open .
- 116,445
- 54
- 318
- 493
- 166
- 1
- 6
-
1
-
I wonder why isn't there common command for opening whatever the GUI is. I have tried all commands from above answers and no one worked for me. This is the only working on Ubuntu – The Godfather Jun 14 '17 at 07:46
-
Is there a way to open gnome as sudo? I tried `sudo gnome-open .` with no luck. – Tim Mar 16 '18 at 20:58
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/
- 176
- 4