简体   繁体   中英

CentOS: bash: grep: command not found

I have CentOS release 6.3

I'm trying to use grep in a script and I get bash: grep: command not found .

Any ideas how to fix this?

A few months ago it was working properly.

  1. Locate your grep installation path. Most likely it's either /bin/grep or /usr/bin/grep .
  2. echo "export PATH=$PATH:/<path_to_grep>" >> ~/.bash_profile . Note that ~/.bash_profile here means your bash startup file. The one that gets sourced on bash shell startup.

In case if you do not have grep for whatever reason or you just can't find / -iname "*grep*" - you can download and install it: gnu FTP . Any other reliable source is fine too. Then use steps 1 and 2 to add your grep directory to system path variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM