Link to home
Start Free TrialLog in
Avatar of Jayesh Acharya
Jayesh AcharyaFlag for United States of America

asked on

remove file problem

I am having trouble trying to delete a file in linux
I have a file that I can see using ls -lrt called events.csv
but when I try to delete I get an error

ls -lrt
total 0
-rwxrwxrwx 0 root root 1048576 Jan 11 14:43 events.csv

sudo rm -rf  events.csv
<< does nothing >> i check back and the file is still there

sudo rm -rv events.csv
<< get error>
rm: cannot remove 'customer-events.csv': No such file or directory
Avatar of Scott Silva
Scott Silva
Flag of United States of America image

Does lsof show the file open by a process?
This seems odd.

Maybe there's some hidden character in the file name.

Or rm is aliased to something odd.

Try this....

/bin/rm -i *.csv

Open in new window


This should prompt you to remove all .csv files one by one. Just answer yes when your file comes up in the list.
FYI: \rm is shorter than /bin/rm for removing aliases.

Also, when you run
sudo rm -rf  events.csv

Are you typing it out yourself, or do you use tab completion?  Maybe there's some hidden/invisible characters in the file name.  Maybe a program is holding it open and writing back to it after you delete.
do you have any application referring to the same file which you are trying to delete?


Maybe that the reason why the file is getting generated after your deletion.

For more understanding about this issue double check the contents inside the file, so you can see any new updates to the file.


or else,
check the timestamp of the file after deletion, so you will be able to know whether files are getting updated or not.
Avatar of Jayesh Acharya

ASKER

in the end I rebooted the server and I could then remove files, I could not find what was holding the files
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial