46

I am using Ubuntu.

From my terminal, how can I open my OS default file manager on a certain folder (e.g. on a folder that I view at current directory)?

say I change my current directory to:

cd /root/dir/

then I list all the files there:

ls folder1 folder2 folder3

Now I want to open folder1. If I type ./ I get:

./folder1 bash: ./folder1: Is a directory

What is the command to make the file manager to open on folder1?

Artur Meinild
  • 26,018
Leo103
  • 579

7 Answers7

54

If you want to open the folder via the nautilus file manager, you can move to the wanted directory like you've mentioned cd /root/dir/ , check the folders under that path using ls and then if you want to open folder1 type:

nautilus folder1
M. Dahmani
  • 666
  • 4
  • 2
17

./ is used to execute file (Not to open directory).

(In)CLI Method: You can open folder in terminal by cd folder1 or dir folder1 or ls folder1.

(To)GUI Method: If you want to open with file-manager (ex:nautilus) then typenautilus folder1 (for Ubuntu nautilus is default file-manager)

Pandya
  • 35,771
  • 44
  • 128
  • 188
7

I have found that simply typing gnome-open "any-oject" opens any folder or file in the default program on Ubuntu. If this happens to be a folder, it uses your default folder-explorer :)

Hme
  • 381
  • 1
  • 4
3
xdg-open /path/to/folder

will open the folder /path/to/folder in the default file manager.

mook765
  • 15,925
3

zsh shell can do that with the AUTO_CD option.

bob@tp ~ % setopt AUTO_CD
bob@tp ~ %
bob@tp ~ % ./Documents
bob@tp ~/Documents % 
bob@tp ~/Documents % pwd
/home/bob/Documents 

Just put setopt AUTO_CD in your .zshrc file (start zsh one time first to create the zsh environment files). You can invoke directly zsh at the terminal prompt to start a zsh session or you can change your default shell to be zsh with the chsh command.

Btw this is not a strange feature, crossable directories do have the "execute" attribute so it makes sense to able to execute a directory like any standard commands.

Emmanuel
  • 1,313
  • 10
  • 12
1

You could specify the directory using ls, it will give you a list of that contents without moving from your directory

ls -al /path/to/directory
Drac Noc
  • 2,133
0

Ubuntu 22 : To open the current directory use command below (or just nau and TAB then .)

nautilus .