Why is this command not working: “ps aux | grep xscreensaver”

I didn’t see any hits about this on google, so I’m asking you:

I just tried to run this command in an ssh session, local is Debian Wheezy KDE, remote is Fedora 21 Gnome:

ps aux | grep xscreensaver

and this is the output:

bash:  grep: command not found...

I never seen this before, what is the cause?

I just few hours before updated the system, but didn’t see any packages marked for removal. There are only two users on the system, and only me installs or removes software on it.

EDIT #1

Here is the commands and output copied,notice that the space is not there the second time:

[<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8dffe2e2f9cdc5e2fef9e3ece0e8">[email protected]</a> ~]# ps aux |  grep xscreensaver
bash:  : command not found...
[<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d5f4242596d65425e59434c4048">[email protected]</a> ~]# ps aux | grep xscreensaver
bash:  grep: command not found...

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Note the double space in bash‘s error message before “grep“: that probably means you’ve typed an unbreakable space (AltGr+space), which can happen quite easily if your keyboard requires AltGr to produce the pipe symbol.

Try dropping the spaces around the pipe symbol:

ps aux|grep xscreensaver

In your updated examples:

[<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="483a27273c0800273b3c2629252d">[email protected]</a> ~]# ps aux |  grep xscreensaver
bash:  : command not found...

bash is trying to run the “unbreakable space” command, which doesn’t exist; hence the error message, “unbreakable space”: command not found…

[<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0e7c61617a4e46617d7a606f636b">[email protected]</a> ~]# ps aux | grep xscreensaver
bash:  grep: command not found...

bash is trying to run the command whose name is “grep” preceded by an unbreakable space, which doesn’t exist either; hence the error message with two apparent spaces between “bash:” and “grep”.

Method 2

The system can’t locate your grep command. Try to fix it or add the full path to the command:

ps aux | /bin/grep xscreensaver

It’s probable that you have to fix your PATH variable.

Method 3

try

 which grep

or if necessary

whereis grep

this may gave you some sort of idea if grep is there


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x