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


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.