?
Solved

To Kill Processes

Posted on 2014-11-13
3
Medium Priority
?
229 Views
Last Modified: 2014-11-13
I want to kill all processes in this list with oracleBB60
oracle    7282     1  0 07:44 ?        00:00:00 ora_arcp_BB60
oracle    7284     1  0 07:44 ?        00:00:00 ora_arcq_BB60
oracle    7286     1  0 07:44 ?        00:00:00 ora_arcr_BB60
oracle    7288     1  0 07:44 ?        00:00:00 ora_arcs_BB60
oracle    7292     1  0 07:44 ?        00:00:00 ora_arct_BB60
oracle    8174     1  0 10:25 ?        00:00:00 oracleBB60 (LOCAL=NO)
oracle    8176     1  0 10:25 ?        00:00:00 oracleBB60 (LOCAL=NO)
oracle    8178     1  0 10:25 ?        00:00:19 oracleBB60 (LOCAL=NO)
oracle    8180     1  0 10:26 ?        00:00:00 oracleBB60 (LOCAL=NO)
oracle    9351     1  0 13:31 ?        00:00:00 ora_mrp0_BB60
oracle    9353     1  0 13:31 ?        00:00:02 ora_pr00_BB60
oracle    9357     1  0 13:31 ?        00:00:12 ora_pr01_BB60

Getting command not found when I run
-bash-3.2$  ps -ef|grep "oracleBB60"|grep -v grep|awk '{ print $2 }'| -exec kill  –f {} \;
-bash: -exec: command not found

What am I missing?
0
Comment
Question by:xoxomos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
Alexander Eßer [Alex140181] earned 1400 total points
ID: 40441451
for KILLPID in `ps ax | grep 'my_pattern' | awk ' { print $1;}'`; do 
  kill -9 $KILLPID;
done

Open in new window


or

ps -ef | grep PROCESS | grep -v grep | awk '{print $2}' | xargs kill -9

Open in new window


or use PKILL
0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 600 total points
ID: 40441529
This will give you a list of process id's
ps -ef|grep "oracleBB60"|grep -v grep|awk '{ print $2 }'

Open in new window


To kill these processes, just give the output of the above (a list) to the kill command:
kill -9 $(ps -ef|grep "oracleBB60"|grep -v grep|awk '{ print $2 }')

Open in new window

0
 

Author Closing Comment

by:xoxomos
ID: 40441613
SEXY :-)  Thanks.
0

Featured Post

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question