When i today accessed my Ubuntu 16.04 server and wanted to remove the file "test2" it was simply not deleted!
I have used
rm test2
as well as
rm -f test2
but it still did not delete it as you can read here:
root@icinga:~# ls
basket desd.save packages scripts src test2 test5 unused
root@icinga:~# rm test2
root@icinga:~# ls
basket desd.save packages scripts src test2 test5 unused
root@icinga:~# rm -f test2
root@icinga:~# ls
basket desd.save packages scripts src test2 test5 unused
I have also tried to remove other files, didn't work!
I am the owner of "test2" and using ls -la test2
you can see that I have the rights to read and write this file!
root@icinga:~# ls -la test2
-rw-r--r-- 1 root root 9 Nov 11 20:33 test2
Using which rm
it says /bin/rm
.
root@icinga:~# which rm
/bin/rm
And also \rm test2
does not delete the file!
I have also checked for the name, there are no spaces at the end etc. because when I use cat test2
the correct content is shown!
I also can create a new file but can't delete this as well.
rm
is also not an alias, I used unalias rm
but it said "rm: not found".
Reboot did also not help.
I had the problem that I accidently deleted a file instead of moving it, so I created a script that simply moves the file to a certain directory.
Then I used nano /etc/environment
and added ":/root/scripts" where this script was located!
After that i created the alias rms by using alias rms='./rm'
. I know it might be dumb naming a file like a system command, I already changed it to remove!
But after doing all this there was the Error that rm can't be found and can be found in the following packages: coreutils. So i tried apt-get install coreutils but it said it is already installed.
So I first used touch /bin/rm
and then chmod +x /bin/rm
.
After that this problem occured!
EDIT: the problem was the /bin/rm
file was empty so I set up an virtual machine and copied the required file to the server!
ls -l test2
– Shrumtype rm
print?rm
might be a broken alias or shell function. – Reiserwhich rm
too? – Shrumrm -f test2
and before hitting enter, hit the tab key (for filename autocomplete); otherwise,rm -f test2*
would for sure take care of it =) – MonteroNo such file or directory
error in that case? – Shrumrm
on a file that doesn't have the whitespace (when it should) would fail and therefore output theNo such file or directory
. This to me suggests that it is not a whitespace issue. – Shrumtouch /bin/rm
-- you created an empty script namedrm
. You're calling that script, a script which does nothing.touch
is not the answer to a missing executable! – Reisertype rm
? – Puppetry