Jayesh Acharya
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
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
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....
This should prompt you to remove all .csv files one by one. Just answer yes when your file comes up in the list.
Maybe there's some hidden character in the file name.
Or rm is aliased to something odd.
Try this....
/bin/rm -i *.csv
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.
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.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.