What is the FreeBSD equivalent of del *.*

I am embarrassed to admit I have spent over 30 minutes trying to execute a painfully easy task. I want to delete all of the rollback files in /var/db/freebsd-update/files #

I have cheat sheets, etc. Nothing addresses this.

I've tried what would seem obvious, the rm *.gz command, but that returns an error of su: rm: Argument list too long. Note, some web searches do say that rm *.* will work in FreeBSD. Not for me.

Thanks very much in advance.
 
as others alluded to

find . -depth 1 -type f -name \*.gz -a -exec rm {} \;

or pipe it to xargs as
find . -depth 1 -type f -name \*.gz | xargs -n 10 rm

Be careful though about filename with embedded spaces. there are options to handle them but that is left as an exercise for the reader.
 
Be careful though about filename with embedded spaces. there are options to handle them but that is left as an exercise for the reader.
That's the nice thing about the lazy approach. You feel less smart doing it, but it might be a little bit safer doing as a few rm commands (as opposed to the "better" xargs approach.)

Unless you accidentally include a / or something 🫣
 
If you don't plan to use rollback to previous minor update it's safe to remove the entire content of
rm -rd /var/db/freebsd-update/*

If you want to remove the entire content "/var/db/freebsd-update/files" then instead of removing file by file just remove the entire direcotry using
rm -r /var/db/freebsd-update/files/ it will be recreated next time when you run freebsd-update

If you want to remove specific type of files using "find(1)" use "-delete" instead of piping to "xargs" as this will spawn a new process.
 
Be careful. Not sure if this is applicable, but when I did chmod or chown, doing .* included .. which it treated as the directory above the current directory which the command was run under.

It takes it literally, which, other than that functionally, I don't understand the reason for the argument doing that. Not sure if this argument behaves like this under rm.

Update:
chmod(1), chown(8):
Code:
-R
Change the user ID and/or the group ID of the file hierarchies
             rooted in the files, instead of just the files themselves.
             Beware of unintentionally matching the “..” hard link to the
             parent directory when using wildcards like “.*”.
rm(1)
Code:
     It is an error to attempt to remove the files /, . or ...
 
Back
Top