Saturday 24 December 2016

My Christmas Eve Present, Thanks to the Linux Command Line

I decided a few days back to delete one of the user accounts on my home computer. I didn't need it, and it was taking up valuable space on the hard drive. However, in a moment of klutzy, brain-dead inattention, I deleted not only that account but my home account. The one with all my work. The one that was the only administrator account on the computer. All I had left was the Guest account, which was all limited in what it could do so that the Guest couldn't cause trouble.

I was up the creek, and should probably have been in a state of panic and terror. I wasn't, though.

Instead, I used the Guest account to do some browsing on the web on how to bring back a deleted account. The answer:

  • Shift-boot the computer to get the the GRUB (boot-up) menu.
  • Choose "Advanced options for Ubuntu"
  • Select one of the options in the next menu that ends in "recovery mode"
  • Press the Return key (Enter key, if you prefer) so that the system boots.
  • Choose from a menu "Drop to root shell prompt"
  • Mount the hard drive so that you can make changes to it by typing "mount -o remount,rw /"
  • Then type "adduser gareth sudo" (It won't be "gareth" for anyone but me. It's the name of the account).
  • Reboot the machine.
On rebooting, I had my account back, my files back, my messy desktop back, everything! Merry Christmas to me, and a big thank you to everyone who has developed the Linux operating system over the years. I love you guys.