Solved

Linux, kill command

Posted on 2013-05-24
4
441 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 167 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 167 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 166 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

726 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