The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for March 11th, 2026

Unix/MacOS: “rm: illegal option — b” or how to remove files that have their name starting with a minus sign.

Posted by jpluimers on 2026/03/11

I had to remove all text files including a -bar.txt from the current directory using bash, so I automatically typed rm *txt resulting in this nice error:

rm: illegal option -- b
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

When there was just a file named -foo.txt in the directory, the error became more interesting:

rm: illegal option -- o
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

Then it struck me: rm is one of those old tools where you can smack all options together. Read the rest of this entry »

Posted in *nix, *nix-tools, Apple, bash, Mac OS X / OS X / MacOS, Power User | Leave a Comment »