2

I did the following to get Skype to recognise my headset microphone (which was not working), as shown as a solution on a question on this website:

rm -rf ~/.config/pulse/
Log out
Log back in
go to desktop settings/'sound'
insert headphones
Go to 'input' section
Do microphone audio test on each available device

But upon logging back in, all my data and everything I customized (including extra programs) is gone. I did not log into a guest account, it's my account and yet everything is gone. It's like I'm a new user. Is there a way to restore this please?

Update:

This is the exact command I typed:

rm -rf ~/ .config/pulse/

with a space after the ~/ but no space between ~ and / Is that a problem?

Raffa
  • 32,237
Bea
  • 95
  • 2
    do history on command line and add the commands into the question. rm -rf ~/.config/pulse/ is good but if there is a space after the ~ that could spell trouble. And this likely needs a backup If not do NOT touch the disk make a dd from a live usb and run testdisk on that copy. – Rinzwind Mar 15 '24 at 17:30
  • This is the command I typed: rm -rf ~/ .config/pulse/ with a space after the / but no space between ~ and / Is that a problem? – Bea Mar 15 '24 at 17:38
  • "with a space after the / but no space between ~ and / Is that a problem?" ... Yes, it is ... ~and ~/ are essentially the same i.e. your entire home directory ... @Rinzwind you seem to have cracked it. Please consider posting an answer. – Raffa Mar 15 '24 at 17:59
  • You have a space between ~/ and .config ... that has deleted your home-dir (~/) and then tried to delete the file/dir .config, which probably gave a 'not found' error at that point. Bad luck :-( – Soren A Mar 15 '24 at 17:59
  • thank you all for helping out here, can I just install testdisk and try to recover the files that way? I'm afraid I do not know much about computer language but I prefer Linux over Windows. I wish I had copied/pasted the command instead of retyping it... Anyway, do I need to work on a copy using a USB stick? And if so, can I use the usb I used to install ubuntu onto my laptop as 'live USB'? Sorry for all the questions! – Bea Mar 15 '24 at 18:11

1 Answers1

2

Problem

User home directory and everything in it were deleted

Explanation:

The command rm -rf ~ performs the following actions:

  • rm: This is the command used to remove files or directories in Unix-like operating systems.

  • -r stands for "recursive," which means it will delete directories and their contents recursively.

  • -f stands for "force," which means it will delete files without prompting for confirmation.

  • ~: This is a shorthand notation for the user's home directory. In Unix-like systems, ~ represents the home directory of the current user.

What Now?

  1. Stop using the system (explained below)
  2. Create a Live Boot USB flash drive - ref
  3. Boot to the flash drive
  4. Recover data
  5. Verify data is back
  6. Create a separate post for the headset issue connecting with Skype

Recover Data

Here's a previous post for recovery:

How to recover deleted files?

Where is the Recycle Bin?

TLDR Linux doesn't have one

Ubuntu (or any Unix-like system) does not have a specific location where deleted files and directories are stored after deletion. They remain in the same location on the disk until their space is reused for new data. Once the space is reused, the deleted data becomes more difficult or impossible to recover.

If you've accidentally deleted files or directories and want to attempt recovery, it's crucial to stop using the system immediately to prevent further data loss and use recovery tools like photorec from a live environment or another system to minimize the risk of overwriting the deleted data.

Rinzwind
  • 299,756
musicman1979
  • 1,147
  • 1
  • 9
  • 26
  • updated to address concerns – musicman1979 Mar 15 '24 at 20:42
  • On Linux you can put the options at the end: rm ~/whatever/ -rf, and it works. Now in this case, would there be a chance that rm ~/ .config/whatev/ -rf would choke on the not right amount of arguments to the command? In any case, I advocate for putting -rf at the end of the command; will work on Linux, but not on MacOS. – Levente Mar 16 '24 at 04:04
  • 1
    Also, "2. Create a Live Boot USB flash drive" I would remark that OP should use another computer to do that, since we need to stay away from using the subject system for anything. – Levente Mar 16 '24 at 04:08
  • Also, in steps 3. & 4., how do you exactly deploy Photorec? I thought TestDisk is also a bootable media, so creating an Ubuntu live USB surprises me. Hence, once booted into the live Ubuntu, how does TestDisk show up? You download it and install it inside the live session, and execute it from there? Or download it and burn it onto another USB? – Levente Mar 16 '24 at 04:14
  • I tried to boot the computer from the flash drive which I used to install Ubuntu on the computer in the first place (about 9 months ago). However, the computer boots automatically from the hard drive. When I press ESC immediately after start up, it only shows the Ubuntu version that's already installed on the computer. I checked the flash drive, it's got Ubuntu on it so it should be useable? Can I recover the files without the use of a usb? – Bea Mar 16 '24 at 10:15
  • 1
    @Bea the consensus seems to be that no, don't use the sick system. It's understandable that you feel the lack of files stressing, but hurrying does not help. It's more important that your rescue procedure is executed in a measured, exact fashion. The USB you used to install Ubuntu should work as a live session indeed: mind you, you need to click the "Try Ubuntu without installing" option, when it shows. But first you need to enter the BIOS menu of your computer and update the boot device order preference such that the USB precedes the internal disk. – Levente Mar 16 '24 at 16:14
  • 1
    Hi again everyone, thank you once more for all your help, it's sooo much appreciated!! I have been able to do the recovery without the USB stick, working straight on the computer. Testdisk was of no help, but Photorec recovered the whole lot. – Bea Mar 16 '24 at 17:04