CHROOT(8) | Maintenance Commands | CHROOT(8) |
chroot - change system's root directory and execute a command there
chroot newroot [command]
The chroot command calls chroot(2) to change the system's root (/) directory to newroot and exec(3) to execute command — and any of its child processes — there.
Please, take note that redirecting the output of command to a file will create it relative to the original root, not in the new one.
For instance, let's redirect command's standard output to a file called "x" at the /tmp directory:
This will create x relative to the original root directory, not in newroot.
If you need to redirect the output inside the newroot, you will need to quote the actual command and prefix it with sh(1) followed by the "-c" option, like this:
cd(1), chroot(2), exec(3)
04/29/23 | Heirloom Toolchest |