1

I accidently moved my /usr/bin/ folder to Downloads using the following command.

sudo mv /usr/bin/ Downloads/

I saw a similar problem like this here

But that doesnot work, because I don't have access to my terminal. Any idea how to solve this?

4
  • @cocomac i got to tty but I cannot login, there is no response after I type my username May 20, 2022 at 15:48
  • 1
    @vanadium not because I cannot access my terminal. May 20, 2022 at 15:59
  • Then post a different question: how to access my terminal. Anyhow, if the system is broke, then boot from a live system. You will then need to mount your system drive to move the misplaced directory back, supplying the appropriate paths.
    – vanadium
    May 20, 2022 at 16:00
  • Remember that your bin path changed, if you try to reach terminal through your gui you have to adjust the path and profile preferences, where custom command resolves to .../Downloads/.../bash
    – user986805
    May 21, 2022 at 5:56

1 Answer 1

2

The gist is simple. Boot a live USB, mount the system partition, and fix it. Now, here's how to actually do it:

  1. Make a live USB. Directions are here (go to the section titled "Creating a Ubuntu LiveCD" and do that) if you don't know how. If you don't already have a live USB (a.k.a. the installation USB stick) you will need to make one from a different machine.
  2. Boot to the live USB, and do "Try Ubuntu"
  3. Open a terminal - I don't use Ubuntu much anymore, so maybe someone else can edit in the name of the terminal app on Ubuntu)
  4. Identify the main system partition. I'll use /dev/sda1 as my example, but use the correct one for you. You can identify it with lsblk (run that in the terminal).
  5. Mount the system partition somewhere (e.g., /mnt). Do sudo mount /dev/sda1 /mnt.
  6. Double-check that ls /mnt contains the root direcory of your main OS. If it doesn't, find out where you messed up and fix it
  7. Do sudo mv /mnt/home/[you]/Downloads/bin /mnt/usr. Replace [you] with your username on your real system. Done!
  8. Do sudo umount /mnt to unmount your system partition
  9. Do sudo shutdown now to turn off the live USB, unplug it, and when you turn your computer on again, it should work

Not the answer you're looking for? Browse other questions tagged .