On 13 Oct 2006, at 17:22, j michaelson wrote:
> i'm a big fan of ogg123 and i often leave it running in the background
> while i'm working or gaming. sometimes i want to skip a track and i
> have to switch to the terminal where it's running and hit ctrl-c to do
> so. i've found that using kill -2 can get the same effect as hitting
> ctrl-c so i'm trying to pipe some commands together to automate this
> for me.
>> i've worked out most of the steps for this. i need to...
> 1 - use top to show all the processes running on my pc
> 2 - use grep to find the line for ogg123
> 3 - somehow isolate the process id from the other information on
> the line
> 4 - use xargs to feed this to kill -2
>> the final command should look something like....
>> top -n 1 | grep ogg123 | ?????? | xargs kill -2
>> can anyone help me with the third step?
Yes, but don't bother - replace all this with
killall -s 2 ogg123
killall is a program which does just what you're trying to do, and
should be available on anything resembling a current Linux
distribution. man killall is your friend.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!