User:Megavolt/chroot

< User:Megavolt
Revision as of 02:57, 12 September 2022 by Megavolt (talk | contribs) (add chroot)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

chroot is a terminal command that gives you the ability to execute commands in another root directory, as well as switch to an interactive shell inside another root directory.

Note
Chroot can also be used to switch from a live session to a local installation to change configurations or make Manjaro bootable again. It is important that the source and the target have the same architecture.

Usage

su/sudo
How to execute a command with sudo or su

The command must always be run with root privileges. The general command looks like this:

{{RootCmd|chroot DIRECTORY COMMAND}

This executes a command within a directory. This command must exist in the directory.

Beispiel

To change into the bash shell of another system that you have already mounted in the current one, it needs this command:

{{RootCmd|chroot /mnt /bin/bash -i}

Usually you can omit /bin/bash -i, because the default is always /bin/sh -i, which is generally a link to the default shell, which is usually bash.