LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-10-2012, 11:42 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Rep: Reputation: 255Reputation: 255Reputation: 255
pkill verbose?


Hi,

Pkill usually by default outputs nothing. pkill -v bblabla crashes my X11.

Would you know a solution that says bit more than no output on exit (man exit read already)?

I have few ideas but an ideally rock-stating solution would be welcome.

thanks
 
Old 08-10-2012, 11:50 PM   #2
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
From the pkill manual the -v option is "inverse" of the option, meaning everything other than the task is killed. It's not verbose.

From the man pages:
Code:
       -v, --inverse
              Negates  the  matching.   This option usually used in pgrep con‐
              text.  In pkill context the short option is  disabled  to  avoid
              accidental usage of the option.
 
Old 08-10-2012, 11:56 PM   #3
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
You could use killall -v instead of pkill too.
 
Old 08-11-2012, 12:12 AM   #4
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by vharishankar View Post
You could use killall -v instead of pkill too.
on mini servers, pkill is surely installed. killall not so much .
 
Old 08-18-2012, 02:38 PM   #5
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
probably you'll find strace useful:
Code:
$ LC_ALL=C ; for i in $(seq 4) ; do sleep 3600 & true ; done ; strace -fe kill pkill sleep
[1] 14049
[2] 14050
[3] 14051
[4] 14052
kill(14049, SIGTERM)                    = 0
kill(14050, SIGTERM)                    = 0
kill(14051, SIGTERM)                    = 0
kill(14052, SIGTERM)                    = 0
[1]   Terminated              sleep 3600
[2]   Terminated              sleep 3600
[3]-  Terminated              sleep 3600
[4]+  Terminated              sleep 3600
 
Old 08-19-2012, 08:33 PM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

as already pointed out -v does not mean verbose. Regarding how to get information from pkill, you should look at the exit status. Eg;
Code:
pkill foo ; echo $?
From the pkill man page
Code:
EXIT STATUS
       0      One or more processes matched the criteria.
       1      No processes matched.
       2      Syntax error in the command line.
       3      Fatal error: out of memory etc.
Evo2.
 
Old 08-25-2012, 09:02 AM   #7
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
maybe it could be cool to add to the deb of pkill a bash/sh code that does output something.

Sthg like /sbin/hpkill, h'' like htop/top, that would output a similar output as killall.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PKILL process brianhickey18 Linux - Newbie 1 05-05-2010 06:38 AM
[SOLVED] pkill -KILL -u root ...... is that bad??? KZeeSoft Linux - Server 7 03-13-2010 10:17 AM
can't stop a process using pkill 2007fld Linux - Server 4 09-12-2007 08:13 AM
pkill ssh elohmrow Linux - Security 2 08-25-2005 09:51 AM
pgrep/pkill d3funct Linux - General 0 09-18-2001 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration