I'm on Ubuntu and I typed cat .bash_history | grep git
and it returned
Binary file (standard input) matches
My bash_history
does exist and there are many lines in it that starts with git
.
What caused to display this error and how can I fix it?
Best Answer
Presumably the file
.bash_history
starts with non-text data, hencegrep
is treating the file as binary. This is confirmed by thefile .bash_history
output:You can read a few bytes from start to have a conforming view:
Here I am reading first 1 KiB.
You can pipe the STDOUT to
hexdump
/od
or similar.As a side note,
grep
takes filename(s) as argument, socat
is useless here; try this: