Change the current working directory.
low risk
cd updates the shell's working directory. `cd -` returns to the previous directory. `cd ~` always goes home. In scripts, always pair cd with `|| exit 1` to catch failure before running destructive follow-up commands.
cd /var/log/nginxNavigate to nginx log directory · explain & risk-check →cd -Jump back to the previous directory · explain & risk-check →cd ~Go to your home directory from anywhere · explain & risk-check →Use `pushd /path` and `popd` when you need a directory stack — navigate away and return without remembering the original path.
Reference text is hand-written and may be incomplete — check man cd for your version. Test destructive commands on a non-production system first.