'grep' command not working on Lubuntu
I'm using Lubuntu 14.04 with a fresh install (Monday) and I noticed that my grep command doesn't work. Whatever I do, it shows me the grep usage page. For instance, if I try to run: grep test * or grep test test.txt, I get the usage page. Command which grep returns /bin/grep, I also tried alias grep="grep" but nothing works.
ls -l /bin/grep prints:
-rwxr-xr-x 1 root root 178216 jan. 18 2014 /bin/grepReinstalling the grep command with:
sudo apt-get install --reinstall grepdidn't make any difference.
The usage message is 76 lines long; the first few lines are:
Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular expression (BRE).
Example: grep -i 'hello world' menu.h main.cgrep --version shows:
grep (GNU grep) 2.16
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others, see <Any ideas?
81 Answer
It is not showing the usage page, it shows the long --help page.
The only way i managed to replicate your grep behavior was to set GREP_OPTIONS="--help"
Try unset GREP_OPTIONS and do env|less and look for other environment variables that might have to be unset.
You might also want to check your .profile,/etc/profile,.bashrc, and so on for variables that can cause this.