http://borkweb.com/story/apache-rewrite-cheatsheet
I will add more to this...!!
Wednesday, July 23, 2008
Wednesday, July 9, 2008
Linux Killing a Process using pid or process name
To get rid of a background job, use the
% kill %2
To get rid of only one process, use the
% kill 12030
If that doesn't kill it, use the
kill
command with the job number as an argument. For example, to kill job 2:% kill %2
To get rid of only one process, use the
kill
command with the process ID as an argument. For example, to kill process 12030:% kill 12030
If that doesn't kill it, use the
-9
option:% kill -9 12030
Here is a ksh script to kill processes by name.
Usage: kill processName
---------------- cut here ---------------------
#!/usr/bin/ksh
str="$1"
ps -ef grep "$str" {
while read aline;do
cmd=`echo $aline awk '{ print $9 }'`
if [ [ $cmd = $0 ] ]; then
continue
fi
cmd=`echo $aline awk '{ print $8 " " $9 " " $10 }'`
if [ [ $cmd = "grep" ] ]; then
continue
fi
cmd2=`echo $cmd grep "$str"`
if [ [ $cmd2 = "" ] ]; then
continue
fi
print "$aline"
pid=`echo $aline awk '{ print $2 }'`
print "kill pid = $pid"
kill -9 $pid
done
}
Linux Getting info of a process like pid(process id)
there are a collection of command to find the process information. which are:
1) Simply use ps command as follows:
pgrep process name
pgrep httpd
pgrep named
pgrep firefox
1) Simply use ps command as follows:
ps aux | grep {process-name}
For example find out if mysqld process (mysqld pid) is running or not:$ ps aux | grep mysqld
Output:
mysql 28290 1.1 2.7 340496 56812 ? Sl Jul31 348:27 /usr/libexec/mysqldpidof command finds the process id’s (pids) of the named programs. It prints those id’s on screen.
2)Find the process ID of a running program using pidof
# pidof httpd
1874 1873 1872 1863 1862 1861 1860 1859 1829
3)PG grep is also used to know the PID
u can use pgrep like thispgrep process name
pgrep httpd
pgrep named
pgrep firefox
Subscribe to:
Posts (Atom)