rm -rf ~/.cache/*
And everything (videos, music, photos) disappeared, vanished. ![]()
Is there any way to recover these files?
Please, someone help me. ![]()
rm -rf ~/.cache/*
And everything (videos, music, photos) disappeared, vanished. ![]()
Is there any way to recover these files?
Please, someone help me. ![]()
Ah, then it wasnāt an accident at all.
Ok, so the command:
rm -rf ~/.cache/*
This isnāt at all dangerous. Did you TYPE it, or did you SELECT then MIDDLE CLICK TO PASTE it?
Can you run this:
history | tail -15
Do that in konsole, then copy and paste it here:
He may have accidentally typed a space between / and the dot, or between the cache and /* in rm -rf ~/.cache/*
This is usually caused by a graphics driver issue, or perhaps ā and especially if youāre in the boiling hot EU right now ā graphics memory corruption.
That would be illogical, given that all the ~/.cache/ directory contains is cache data, i.e. data which is only needed for speeding things up ā e.g. previews of images, fonts and icons, copies of visited web pages, et al ā and which can easily and automatically be reconstructed.
Of course, if for whatever bizarre reason you chose to consciously store things in ~/.cache/, then you would indeed have now lost that data.
Real cache files will automatically be reconstructed by using the applications that put that cached data there in the first place.
For instance, by opening a file manager and navigating to a directory containing images, the file manager will start reconstructing a preview cache of those images, even though this would take a bit longer due to the file manager now having to actually open and read the files in order to find the data in there for regenerating a preview.
On the other hand, if you had indeed deliberately put files in ~/.cache/ which donāt belong there, then those files will now be lost, because most backup solutions donāt make a backup copy of cache directories.
I wrote āaccidentā in the title, meaning I had absolutely no idea what I was doing. I typed this command into the terminal and everything immediately changed: the wallpapers disappeared, the browser went into a state as if it had no configuration, the text program said it was the first time I was using this programā¦
Then, as @Arrababiski suggested, you probably had a typo in there ā a space after the first slash ā and as such youāve deleted the contents of your entire home directory. And in that case, Iām afraid that if you donāt have a backup of your home directory ā which you should have! ā your data is indeed irretrievably lost.
Ok, this is a fundamental mistake.
As an experiment, try to follow this instruction.
ls ~
Then SELECT everyting in the terminal, copy and paste it here after typing three b ackticks
``` ā like this
⯠ls ~
0
agebracket
archcanary
Audio
aur-malware-check
backintime
battery-percentage-bt
Bendy.shortcuts
ben_transfusion_20251108_1025
BreezeChameleon
build
cache.sqlite
data
Default.shortcuts
Desktop
Documents
Downloads
Dropbox
dupes-baloo.sh
font-test.txt
font-test.txt.BAK
forum-scout-qt
gb
gitlab
go
hwinfo.txt
Imported Copies of 2017 pictures
input.conf
inxi.txt
keyboard-grid.sh
Library
list-all-keys.sh
Music
myenv
node_modules
openjdk-devel
pictures
Pictures
PKGBUILD
plasma.txt
Playlists
Projects
Public
radioactive
Scripts
stdin.xkm
Templates
test.conky
Tosh.txt
tree.txt
Videos
The āaccidentā is that, without knowing it, you ran a command to delete all the contents of your user folder. Thatās the problem with chatgpt: if something goes absolutely wrong, the problem is completely yours.
Have you got a backup?
If not, I think the best solution is removing the disk from your computer, connect it to another computer with a working Linux system, and run TestDisk or other file recovery software (or a Windows system and use Recuva, EaseUS Data Recovery Wizard, etc).
I typed in the terminal and this appeared:
[henrique@henrique-tobefilledbyoem Desktop]$ history | tail -15
1 rm -rf ~/ .cache/*
2 history | tail -15
[henrique@henrique-tobefilledbyoem Desktop]$
PS: I donāt know if I did it right.
Ok, Iām sorry - I felt really sad because itās a very bad situation to lose data, itās why I always made sure to have backups and snapshots since I stopped using Windows Vista back in 2013.
Back then I used Testdisk, left it running overnight, to recover as much as I could from a HDD before reformatting it and installing Ubuntu.
If this is the only command that was used, files and directories under the .cache hierarchy would have been deleted, at least partially.
Ideally, that command is best run outside of the GUI, via a TTY; in this way, cached data is not in memory while you delete .cache.
Iād suggest logging out and logging in via a TTY, and then deleting the entire .cache directory, in case there are remnants remaining, and then reboot.
rm -rf ~/.cache
When deleted properly, there is no reason to be concerned, as the .cache directory will be automatically re-built as you continue to use your computer.
Unless you did something else that youāre not telling us, there should be no need to panic.
Regards.
Clearly. Always ask.
There is a right way and a wrong way to do everything.
Just one extra space, and a guaranteed disaster.
You typed the command with a space.
Iām sorry. Iām guessing you donāt have a backup - the only way now would be to remove the disk and try to recover data thatās deleted.
I feel sad - Iām sorry about my first reaction - I was angry that you made a fundamental mistake because you didnāt know how to select and middle-click to pasteā¦
You did TWO things:
Donāt save or install anything. Shut down and boot from a live CD.
Mount your disk read-only
Run recovery toolsā¦
UFS Explorer is a very good recovery software, they have a Emergency Recovery Live CD. You can download the ISO in another computer, create a boot usb drive, boot your computer from it and take a look if files can be recovered:
Each file was in the indicated folders: videos in the āvideosā folder, photos in the āimagesā folder, etc. I couldnāt predict that this bad thing with blurry fonts and icons would happen. I tried to fix it using GPT chat and followed this terminal command and then this happened to me. Was it my mistake? yes, it was. But it wasnāt something conscious, as I only understand the basics of computing.
I understand, and I am very sorry for your loss.
Moving forwards, you should investigate a tool called back in time, this will create a backup of everything in your home folder so then you can always recover data if you delete it or if your disc suddenly fails.
And the next, possibly more important lesson, is that you should select a command with your mouse and middle click to paste⦠Because everybody can make a typo.
The way that I sorted out this problem in the past, many years ago, I used a live CD and run testdisk to copy all the data that had recently been deleted onto another hard drive.
You should never do that. This is the official Manjaro support forum, so this is the place where you should have come for information ā and just for the record, there are various threads here about blurred fonts and blurred icons, which is why I suggested the most likely culprits for that sort of issue.
Well, in this particular case, it wasnāt the A.I. that gave you the wrong instructions ā it actually gave you a correct one ā but you adding a space in there. A space is a so-called field separator, even in regular human writing.
Withoutspaceseverythingwouldbecomehardtoread.
But you blindly ran the command without knowing what it does or how to use it ā hint: every command in a UNIX system has a manual, a so-called man page, which tells you what it is and how you should use it. The command you issued by inserting that space was āRecursively remove everything in my home directory without asking for confirmation.ā
rm = remove/delete
-r = recursively
-f = force (i.e. no confirmation)
~/ = your home directory
I think we all understand that much.
Well, I hate to have to be cynical here and now, given the loss of your data, and I donāt want to sound condescending, but Manjaro really isnāt a distribution for absolute beginners, notwithstanding that it has ā for commercial reasons ā been profiled as such in the past in a misguided attempt to lure more people into installing and running Manjaro.
Iāve written a (not too long) essay on this subject, several years ago now, and you may not be in the right mindset right now to read it, given that youāve got a bigger problem on your hands, but Iāll post the link below anyway, just for reference. ![]()
Now, as an additional piece of advice, do yourself a favor and seek out a computer store near you, and purchase an external HDD or SSD which you can connect to your system via USB. SSDs are expensive now due to the market responding to the storage greed of A.I. systems, but you should be able to pick up a 4 TiB spinning hard disk drive for little money ā itāll be slower, but just as reliable as a storage medium.
Create an ext4 filesystem on it, mount it, and then copy over either your entire home directory, or at the very least your ~/Documents, ~/Downloads, ~/Music, ~/Pictures, ~/Projects, ~/Video and ~/Templates directories onto it every day. There are software solutions in the repository to help you do this sort of thing very easily, with version numbers or dates and times added to the folders, so that you can keep multiple iterations backed up side by side.
Make it a habit of doing this every day when you log off for the night, and after copying the stuff over, unmount the device again, power it off, and pull out the USB cable, so that the device is truly disconnected from your computer and that your data will thus be safe.
Well, it was not a consequence of it, but you making a mistake trying to solve that. Many of us have been there at some point when we were learning. Years ago I executed a dd if=/dev/zero of=/dev/hda command on my main disk (the intention was to do it on a secondary disk) and that zeroed it without any possibility of getting back anything.
And this could have happened on any operating system. Even in Windows if you execute the wrong command, bad things could happen.
Take this as an opportunity to learn a bit more on how computers works, so you can avoid similar occurrences in the future.
About getting your files back, as @ben was explaining to you, you have the possibility of getting back at least part of your data. When you delete a file on your disk, the actual content is not deleted, only the directory entries that tells the system where to find the actual content. Something like removing some chapters out of the index pages of a book. You donāt know anymore where exactly to find those chapters, but you can manually search for them going through all the pages of the book. File systems are more complex than that, but that is the general idea of how you could get back at least part of your files.
For this to happen, you should stop using the disk immediately, because the system thinks that the space your data resides, is available. So it could overwrite it with whatever data has to be stored on disk. To actually try recover your data, you need specialized tools and knowledge on how to use them, but that is out of the scope of this forum. You can also send your disk to a firm specialized on this kind of things (recover data) but they can be quite pricey. In any case there is no guarantee of recovering anything, but I would say you have a good chance of recovering at least part of it.
You can also accept what just happens and just move on. Sh*t just happensā¦
I guess the rm command needs more safeguards for some more hardcoded path to refuse to delete without double validation, like for /
By default, rm is aliased in Manjaro ā and possibly Arch ā as ārm -iā (interactive). However, the use of the -f switch overrides the -i.