I have installed fedora 23 and this error happened when i want to use grep in su mode user :
[root@alifed alireza]# ps aux | grep dnf bash: : command not found...
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You, weirdly, have a Unicode formatting character 200C, "zero width non-joiner", after the
| in your command.
Where did you get this example from? I assume you are copying and pasting it directly from some documentation, and for some reason this odd formatting character got in there — I'm not sure exactly why, as I can't think of a good reason.
The error bash is giving you is literally correct. With the character replaced with a visible representation, the error becomes obvious:
[root@alifed alireza]# ps aux |200C grep dnf bash: 200C: command not found...
The shell thinks that you're piping the output of
ps aux to a command named that unprintable character with
grep dnf as arguments. But, of course, there is no command by that name, so it tells you so.
Why did I suspect that this was the problem? Because bash's normal error syntax is
$ noncommand bash: noncommand: command not found...
and in the error you reported, there's a blank where the missing command should be. If
grep were missing, it'd tell you
bash: ps: command not found or
bash: grep: command not found. And, since you pasted the exact command and error into your question instead of retyping it (awesome — always the best practice!) I was able to examine the results and replicate. (This happens as non-root, too, by the way — the
su thing is a red herring.)