mkdir -p creates /opt/myapp (and parents, if missing), then chown hands ownership to the deploy account so that user can write, build, and pull without sudo. Keeping the service user as owner avoids running the app as root. If the directory already existed, only the ownership changes.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.