Okay, let's break down why you got the error pkill: invalid option -- ' ' when you ran pkill -f "-n 100".
pkill's Argument Parsing: Like many command-line utilities, pkill processes arguments. Arguments starting with a hyphen (-) are typically interpreted as options. The first non-option argument is usually treated as the main subject of the command (in this case, the pattern to search for).
The -f Option: You correctly used -f, which tells pkill to match against the full command line of processes, not just the process name. This option is processed first.
The Pattern "-n 100": You intended this string, including the quotes, to be the pattern that pkill searches for in the full command lines of processes. Because it's in double quotes ("), the shell passes "-n 100" to pkill as a single argument.
The Conflict: The problem arises because your pattern "-n 100"starts with -n, and -n is also a valid option for pkill (--newest, which selects the newest process matching the pattern).
The Misinterpretation: Even though "-n 100" is intended as the pattern, pkill (or the underlying argument parsing library it uses) likely sees that the argument starts with - and tries to interpret it as an option string first. It sees -n and recognizes it as an option. It then continues parsing the rest of that string (" 100") as if it were part of option arguments or potentially another short option combined.
The Error: During this incorrect parsing of " 100" as if it were options, pkill encounters the space character (). A single space is not a valid short option letter, nor is it typically a valid argument to an option in that context. pkill signals that it found an "invalid option" which turned out to be just a space character during its parsing attempt.
How to Fix It:
To tell pkill (or most other commands) that you want to treat everything that follows as arguments or patterns, even if they start with a hyphen, you use the special argument --.
The corrected command is:
pkill -f -- "-n 100"
By adding --, you signal the end of options. pkill will then correctly interpret "-n 100" as the pattern to search for in the full command line.