chroot
Quick Reference
Command Name:
chroot
Category:
system management
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
Syntax
chroot [OPTION] NEWROOT [COMMAND [ARG]...]
Options
Option | Description |
---|---|
--groups=G_LIST |
Specify supplementary groups as g1,g2,...,gN |
--userspec=USER:GROUP |
Specify user and group (ID or name) to use |
--skip-chdir |
Don't change working directory to '/' |
--help |
Display help message and exit |
--version |
Display version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the chroot
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Change root into a directory and run a shell sudo chroot /mnt/system /bin/bash
Advanced Examples:
# Mount necessary filesystem before chrooting sudo mount --bind /dev /mnt/system/dev sudo mount --bind /proc /mnt/system/proc sudo mount --bind /sys /mnt/system/sys sudo chroot /mnt/system /bin/bash