I was asked the question "what does the cd /etc command do?". This is my answer:

This command cd /etc changes directory to the directory specified after the slash /. The /etc refers to a folder in the root called etc. If the linux user was inside the /etc folder, typing cd / would bring the user to the root.

Is my understanding correct?

  • What if /etc is a symlink? – Andy Dalton Mar 28 '16 at 21:53

The command

cd /etc

will change the current directory to "/etc" - i.e. the etc directory in the root (or /) directory.

In your answer the part about "after the slash" is wrong and the part about "if the user were in..." is right but irrelevant to the question.


You may wish to consult the manual page for a shell (e.g. man bash or man sh) for a precise definition of the semantics of cd to work on – depending on the audience for your answer, there are some special cases which your wording does not consider. Even so, cd /etc changes to the directory called /etc. It does not "change to the directory specified after the slash", as (strictly read) this would imply that it would change to a subdirectory "etc" located beneath the current directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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