📅  最后修改于: 2023-12-03 15:13:40.780000             🧑  作者: Mango
Have you ever experienced a situation where your laptop or computer didn't work properly because of a corrupted operating system (OS)? In such cases, you might not be able to access the regular graphical interface that you're familiar with. But don't worry, there's always a solution to every problem!
In this tutorial, we'll discuss how to boot your computer from a pendrive using the command line and Shell/Bash. This method is helpful in situations where your OS is corrupted and you need to reinstall it or access the files from the hard drive.
Insert the bootable USB drive into your computer's USB port.
Power on your computer and press the key to enter the boot menu. The key varies depending on your computer's make and model. Common keys are F2, F8, F10, and F12. Consult your computer's manual or search online for the specific key for your computer.
After entering the boot menu, select the USB drive as the boot device and press Enter.
The computer will then boot from the USB drive and load the OS installation files or the live environment.
If you want to install the OS, follow the on-screen instructions. The installation process varies depending on the OS that you're installing.
If you want to access the files from the hard drive, you can use the file manager that comes with the live environment or mount the hard drive using the command line.
To mount the hard drive using the command line, follow these steps:
sudo fdisk -l
to list all the available storage devices on your computer./dev/sda
.sudo mkdir /mnt/hdd
.sudo mount /dev/sda /mnt/hdd
. Replace /dev/sda
with the device name of your hard drive./mnt/hdd
directory.Booting from a pendrive using the command line and Shell/Bash is an essential skill for every programmer and IT professional. It helps you to recover from a corrupted OS or access the files from a failing hard drive. By following the steps in this tutorial, you can easily boot your computer from a USB drive and perform various tasks like installing an OS or accessing files.