?
Solved

Linux, kill command

Posted on 2013-05-24
4
Medium Priority
?
447 Views
Last Modified: 2013-05-24
I am using RHEL 6.4

In Unix based OS's, you perform something like

    ps -ef | grep appname

Open in new window


This command returns a PID, from which you perform something like

   kill -9  9999

Open in new window


This is simple enough, but sometimes I am in a hurry,

Is there a command or a script that can ferform something like

   killapp   appname

Open in new window


without the necessary PID lookup, turning it into a single command instead of two ?

Thanks
0
Comment
Question by:Los Angeles1
[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
4 Comments
 
LVL 8

Assisted Solution

by:Pepe2323
Pepe2323 earned 668 total points
ID: 39195121
Hi

Yes there is something like this.

if you use pkill app name i will kill the process related with that app name

 pgrep,  pkill  -  look  up or signal processes based on name and other
       attributes

Regards.
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 668 total points
ID: 39195125
you could use pkill command for that

pkill appname

http://linux.die.net/man/1/pkill
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 664 total points
ID: 39195170
Keep it mind that pkill search for names / pattern - be careful when you use it on generic names like bin or usr.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39195302
Or just write a simple wrapper script that does the ps for you, filtering the pid(s), adding a simple check that asks you a question in case it finds more than one pid.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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 …
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month12 days, 20 hours left to enroll

777 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