2017201708281_grep .txt, 20170828 grep
[70708281_grep .txt
-- // Grep is often used to filter display information.
# Ps-ef | grep oraagent
Oracle 13416 1 0 2016? 1-20:48:04/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 17423 1 0 2014? 2-03:32:14/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 21718 1 0 2014? 1-16:45:43/u01/app/11.2.0.4/grid/bin/oraagent. bin
Root 87599 66070 0 00:00:00 pts/0 grep oraagent
-- // There is a small regret that the grep oraagent execution information is also brought out. The common method for many people is
# Ps-ef | grep oraagent | grep-v grep
Oracle 13416 1 0 2016? 1-20:48:05/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 17423 1 0 2014? 2-03:32:15/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 21718 1 0 2014? 1-16:45:43/u01/app/11.2.0.4/grid/bin/oraagent. bin
-- // The actual solution is very simple. The modification is executed as follows:
# Ps-ef | grep oraagen [t]
Oracle 13416 1 0 2016? 1-20:48:04/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 17423 1 0 2014? 2-03:32:15/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 21718 1 0 2014? 1-16:45:43/u01/app/11.2.0.4/grid/bin/oraagent. bin
-- // The actual grep is used to filter and display information or oraagent. In this case, grep oraagen [t] is used to execute grep commands. In this way, the required information is displayed if the grep command does not meet the filtering condition oraagent.
-- // Information.
-- // For the following questions, add the header to display the ps-ef. Generally, use egrep.
# Ps-ef | egrep "oraagent | UI [D]"
UID PID PPID C STIME TTY TIME CMD
Oracle 13416 1 0 2016? 1-20:48:08/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 17423 1 0 2014? 2-03:32:16/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 21718 1 0 2014? 1-16:45:45/u01/app/11.2.0.4/grid/bin/oraagent. bin
Root 111809 66070 0 00:00:00 pts/0 egrep oraagent | UI [D]
-- // But in this way, the egrep oraagent | UI [D] is brought out. In fact, if you define grep-related environment variables, you can see the color of the display to understand the problem.
# Env | grep-I grep _
GREP_COLOR = 01; 32
GREP_OPTIONS = -- color = auto
-- // In this way, oraagent is green. The modification is as follows:
# Ps-ef | egrep "oraagen [t] | UI [D]"
UID PID PPID C STIME TTY TIME CMD
Oracle 13416 1 0 2016? 1-20:48:09/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 17423 1 0 2014? 2-03:32:17/u01/app/11.2.0.4/grid/bin/oraagent. bin
Grid 21718 1 0 2014? 1-16:45:45/u01/app/11.2.0.4/grid/bin/oraagent. bin
-- // This is OK, and there may be many ways to do it! Pai_^ .'