-4

I tried cd * in my terminal (ubuntu), it changes my directory to the first directory listing

closed as unclear what you're asking by Romeo Ninov, roaima, Thomas, Jeff Schaller, RalfFriedl Jan 20 at 17:49

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.

4

cd is generally a shell builtin. So the behavior will be dependent on the shell, shell version, and possibly the OS you are using. For example, in Bash on Debian 9 I get the following:

bash: cd: too many arguments

This is because the * is first interpreted using globbing and then there are too many directories and files in the directory I used when I tried this.

However, if I had only one directory, called folder in the current directory the shell would glob it into:

cd folder

This would succeed and change into folder.

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