Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I open a folder in a dir?

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 try the "./" I get: ./folder1 bash: ./folder1: Is a directory

How can I do so without having to type cd again ie: cd $(pdw)/folder1

share|improve this question

closed as unclear what you're asking by Sneetsher, Radu Rădeanu, Eric Carvalho, belacqua, mniess May 14 '14 at 11:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

just type cd folder1 – Avinash Raj May 11 '14 at 13:00
If you want to change directory you should use cd folder1. you used ./folder1 it wont work './' is used to execute an executable file but folder is a directory. – Sudheer May 11 '14 at 13:02
@user280447 : Mention exact method that you want to open (CLI or GUI) and Linux os: Ubuntu or other? – Pandya May 11 '14 at 13:08
What do you mean by "open" it? List the contents? Open it in graphical file manager? – terdon May 11 '14 at 13:16
xdg-open ./folder1 – Sneetsher May 12 '14 at 4:03

./ 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)

share|improve this answer

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
share|improve this answer

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 :)

share|improve this answer

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

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.

share|improve this answer

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
share|improve this answer

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