Score:-1

How to fix when files keep disappearing without reason

so flag

How to fix when files keep disappearing without reason? Or maybe because I accessed it? I'm on Ubuntu 22.04

money@money:~$ ls move*
move2.sh  movenew.sh  movestart3.sh
money@money:~$ cat move2.sh
cat: move2.sh: No such file or directory
money@money:~$ ls move*
movenew.sh  movestart3.sh
money@money:~$ 

Is there a log of systematically deleted file or something? My .bash_history also gone sometimes but got it back after a restart. Any clue?

user535733 avatar
cn flag
Do you have some special or unusual install of Ubuntu or old hardware? How is your system different in any way from a stock install on an ext4-formatted, reasonably new hard drive or SSD?
Artur Meinild avatar
vn flag
No clue. This is worrying - my files don't randomly disappear. The two most obvious reasons I can think of is hardware failure or malware..
God of Money avatar
so flag
malware on linux?
Artur Meinild avatar
vn flag
Yes? As you noted, I didn't try to answer your question directly. I stated that the most obvious reasons I could think of for mysteriously disappearing files were those two. But your question lacks considerable detail for anyone to act on. If you can rule out malware, I would guess your harddrive is dying. Or maybe someone can provide another reason I'm not aware of..
Artur Meinild avatar
vn flag
6 year old article for reference: https://www.bleepingcomputer.com/news/security/killdisk-ransomware-now-targets-linux-prevents-boot-up-has-faulty-encryption/ Malware can also be some "friend" who put a script on your PC that randomly deletes files. How are we to know what has happened on your computer?
Artur Meinild avatar
vn flag
Please list output of `type cat` in your question. Thanks.
Artur Meinild avatar
vn flag
Please add a detailed view of your filesystem. Add output of either `tree` or `ls -la` to your question. Thanks.
Score:0
cn flag

Your files haven't disappeared and I doubt that you have a virus.

The command ls lists the contents of a directory. In order to access the files listed, you must change directories, cd, to the directory. Please try:

cd move*
cat move2.sh
Artur Meinild avatar
vn flag
I don't think the OP has malware either - but I still don't understand this answer. How do you explain that the same command (`ls move*`), run from the same directory, produces 2 different results (`move2.sh` is absent from the latter)? Also, should there be a directory named `move*`?
chili555 avatar
cn flag
There probably should not be a directory with an asterisk, commonly used as a wildcard. However, if there were two or more directories named , for example, move, move1 and move2, the result of `ls` would have shown it. I have no explanation for the different result of `ls`.
Artur Meinild avatar
vn flag
I just got the crazy idea that the OP's `cat` command has an alias that deletes the file.- asked for clarification..
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.