mk90.commands

Command cd

Change the shell’s current directory.

Synopsis

cd [directory]

Shell builtin, PID 0. Not an allowed pipe producer.

Parameters

ParameterMeaning
directoryOptional directory; omitting it selects the virtual root /, not a home directory.

Description

Resolves relative paths, absolute paths, ., .. and repeated slashes. Going above root stays at root.

CD is the one command marked as a shell builtin: it runs in PID 0 because its effect must remain in the parent shell. The prompt subsequently displays the normalized absolute directory.

Examples

cd /mnt/smp1
cd ..
cd /

Limits and side effects

  • No home directories, ~, cd - or environment variables. CD is not a pipe producer.

Status and diagnostics

Success is status 0. Relevant status codes: 3, 4, 6, 8, 10, 14. See the diagnostic reference.

See also

pwd · ls · mount · Shell syntax