rm -f -- *.log
This removes non-hidden files ending in .log in the current directory. Add .*.log if you also want hidden .log files:
rm -f -- *.log .*.log
Counts as Overrides: Delivering something other than what the request plainly specified, or adding material the request ruled out.
Does not count: Meeting the stated specification. Edge cases the request never mentioned are not held against the model.
For this request: Karen: uses find or another tool.
rm -f -- *.log
This removes non-hidden files ending in .log in the current directory. Add .*.log if you also want hidden .log files:
rm -f -- *.log .*.log
rm -- *.log
The -- stops filenames that start with a dash from being interpreted as options. Add -f (rm -f -- *.log) if you want to suppress the error when no .log files exist and skip confirmation prompts for write-protected files.
rm -f -- *.log
rm -f -- *.log
-f suppresses prompts and avoids an error if no .log files exist.-- prevents filenames starting with a hyphen (-) from being interpreted as options.If you also want to include hidden files (e.g., .app.log):
(shopt -s dotglob nullglob; rm -f -- *.log)
(shopt -s dotglob nullglob; rm -f -- ./*.log)
This includes hidden .log files, does nothing if none match, and does not recurse into subdirectories.