473,466 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to kill a process, if we have the process name?

56 New Member
Inside a shell script, how can we kill a process during run time, if we know only the process name.
May 4 '12 #1
2 3560
Luuk
1,047 Recognized Expert Top Contributor
On linux there's a util called 'pidof'
Expand|Select|Wrap|Line Numbers
  1. /tmp # pidof apache
  2. /tmp # pidof httpd2-prefork
  3. 19760 19740 19730 19672 19607 19604 7665 6781 6778 2276 2270
  4.  
To kill the prcess(es) of i.e. apache, you could do:
Expand|Select|Wrap|Line Numbers
  1. kill `pidof httpd2-prefork`
May 4 '12 #2
sicarie
4,677 Recognized Expert Moderator Specialist
Or, if you're interested in killing everything related to the process, you can use killall. For instance, if Mozilla freezes:
Expand|Select|Wrap|Line Numbers
  1. killall mozilla
  2.  
May 7 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Carlo Filippini | last post by:
Hi on a XP machine I start a ftp process with: $pid = open (CMD, "ftp -in -w:1024 -s:$file_cmd $server 2>&1 |") or die "Can't execute: $!"; In some occasions I want to kill the process, but I...
5
by: Thomas Chan | last post by:
I have an application that need to launch acrobat reader. But before I open acrobat reader, I want to check there is any existing acrobat reader opening and kill them first. What can I do? Can...
3
by: Wilfried Mestdagh | last post by:
Hi, I use C# 2005 beta with NET 2005 beta. How to kill a process ? Is this possible in this version ? I foundsom things in help but it is not clear to me, if someone can give me brief example it...
2
by: charmis | last post by:
Hi everyone, I am trying to include one feature using excel object in my application. I am giving the code to create and kill the process , that i got from Microsoft site.......but nothing is...
1
by: Lee Gillie | last post by:
I need to be able to kill a process programmatically under ASP.NET. IIS runs under the local system account. The user accessing the web is using anonymous access. We would prefer NOT to grant...
7
by: Joe | last post by:
If I'm using process.kill, I can only kill processes, which are created in the same login session. (I'm using win2000, I'm in the local admin group) Processes created by me in earlier logins or...
0
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a...
3
by: Optix | last post by:
Hi,How do i terminate/kill a process based on its windows caption - C++ ? Would anyone mind posting an example source code of it? E.g I do not want calc.exe to ever run in my pc so i want to...
0
by: stef mientki | last post by:
hello, is there a library to kill a windows process by name ? thanks, Stef Mientki
4
by: yxq | last post by:
Hello, I want to kill the Explorer process, after Explorer process has been killed, it will restart automatically immediately. How to disable it restart automatically? for example, in Windows Task...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.