Run commands through a directory

I need to run commands through a Linux install directory that I’m not booted to.

I had an SSD that has an Ubuntu install but I’m booted through an Ubuntu live USB,
I need to run commands relative to the Ubuntu SSD, I remember doing this in a manual arch install a long time ago but I forgot how to do it and I can’t find it online.

So if I run eg “PHP help.php” I need it to just run the php in the ssds /

So I don’t need to specify /media/ssdmnt/help.php.

You need to chroot(change root) into your SSD so the commands you run modify that environment instead of the transient environment running from USB.

Manual page: https://man7.org/linux/man-pages/man2/chroot.2.html
Obligatory googled-for SE page which might be related: https://superuser.com/questions/111152/whats-the-proper-way-to-prepare-chroot-to-recover-a-broken-linux-installation

2 Likes