Why ‘cd’ is not an external command like ls?

cd command changes the current directory to desired valid path. The shell is a process that runs user commands. Each command is run by forking a new process and exec’ing. After exec, the child process dies. cd changes the current environment. If cd is an external command, the usual flow of fork->exec would cause environment…

%d bloggers like this: