1
I am trying to remove a file using rm. However, if I do ls, all the information about the file is ?????? ?? ?? example.txt... And calling rm returns that no such file exists. How can I force a remove of the file?
1
I am trying to remove a file using rm. However, if I do ls, all the information about the file is ?????? ?? ?? example.txt... And calling rm returns that no such file exists. How can I force a remove of the file?
1
You can try:
rm -f example.txt
Or
touch example.txt && rm -f example.txt
(update timestamp on the file first)
Or
chmod 777 example.txt && rm -f example.txt
(set readable, writeable, executable then remove it).
As suggested above, fsck
is a good idea as well.
Someone care to explain why this answer is -1? – Mistiry – 2010-08-03T21:58:15.413
Don't know. I can see nothing wrong with it. I upvoted, but it should be at 1 now... – pypmannetjies – 2010-08-04T07:36:09.993
Did any of those fix your problem? Thanks for the upvote! – Mistiry – 2010-08-04T21:21:55.350
2
Depends on the filesystem used, but most of the time you need to check the filesystem with fsck (the variant of it, whatever your filesystem is).
1The questionmarks could also mean your file name contains characters your terminal can not display. Does ls -lha provide more information? – matthias krull – 2010-08-02T15:35:33.413