How do I delete all occurances of a file in Linux?
How can I delete one file from every place on my disk using Linux? In Windows' I'd open up a command window and use the command
del archive.txt /s
but what's the Linux equivalent?
Alright, I know about the del command in DOS, but I don't know about the "/s" flag. I had to dig for quite a while before I finally found out that the "/s" switch deletes all files from subdirectories. As I suspected, what you're trying to do is delete all files with the specified name regardless of where they are on your PC.
First off, this seems rather dangerous! If nothing else, I'd certainly start out in my own home directory (just use cd without any arguments and you'll be taken there directly) to ensure that I didn't accidentally delete a file that some other program (or user!) needed.
In any case, the Linux command you seek is find and it's far more powerful than the DOS del command, but, um, more complex too.
To find all occurrences of a specific filename at the current point in the file system and below, use this command...
del archive.txt /s
but what's the Linux equivalent?
Alright, I know about the del command in DOS, but I don't know about the "/s" flag. I had to dig for quite a while before I finally found out that the "/s" switch deletes all files from subdirectories. As I suspected, what you're trying to do is delete all files with the specified name regardless of where they are on your PC.
First off, this seems rather dangerous! If nothing else, I'd certainly start out in my own home directory (just use cd without any arguments and you'll be taken there directly) to ensure that I didn't accidentally delete a file that some other program (or user!) needed.
In any case, the Linux command you seek is find and it's far more powerful than the DOS del command, but, um, more complex too.
To find all occurrences of a specific filename at the current point in the file system and below, use this command...