How to Delete a File in Linux Command Line?
Contents to Remove (Or Delete) a File or Directory in Linux from the Command Line, Use the Rm (Remove) Command. Be Extra Careful When Removing Files or...
To remove (or delete) a file or directory in Linux from the command line, use the rm (remove) command.
Be extra careful when removing files or directories with the rm command, because once the file is deleted it cannot be recovered.
If the file is write protected you will be prompted for confirmation as shown below.
How do I find and delete a file in Linux?
With this you will be able with the Linux find command to find your JPG files older then 30 days and then execute rm command on them.
- Delete command. find /path/to/files/ -type f -name ‘*.jpg’ -mtime +30 -exec rm {} \;
- Move command.
- Combine commands.
How do I delete a file in Terminal?
Open Terminal, type “rm” (no quotes, but there should be a space after it). Drag & drop the file you want to remove onto the Terminal window, and its path will be added at the end of the command, then hit Return. Your file will be removed beyond recovery.