chroot - change system's root directory and execute a command there
command calls chroot(2)
to change the system's root
) directory to newroot
— and any of its child processes — there.
- The directory to switch the command's system root to.
- The command to execute, relative to NEWROOT.
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
" at the /tmp
- # chroot newroot command >/tmp/x
This will create x
relative to the original root directory, not in
If you need to redirect the output inside the newroot
, you will need to
quote the actual command
and prefix it with sh(1)
the " -c
" option, like this:
- # chroot newroot /bin/sh -c 'command >/tmp/x'
cd(1), chroot(2), exec(3)