LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-10-2005, 01:21 AM   #1
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
simple bash piping problem


what would the command be to kill a process, say, of 'oclock' program?
i have got:
Code:
ps x | grep oclock | cut -c 2-5
which lists the PID of the program.. dont i just append " | kill" to it to pipe it to the kill command? or do i put kill first?
 
Old 09-10-2005, 02:02 AM   #2
angelushu
Member
 
Registered: Oct 2003
Distribution: Slackware/SuSE/Fedora
Posts: 42

Rep: Reputation: 15
Code:
kill `ps ax | grep oclock | cut -c 2-5`
 
Old 09-10-2005, 12:26 PM   #3
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Original Poster
Rep: Reputation: 60
thats right.. i knew it was something simple i forgot. thanks.
 
Old 09-10-2005, 03:12 PM   #4
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
You might like to add
Code:
| grep -v grep
to your pipeline to avoid giving kill excessive PIDs.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple bash problem - checking for files and displaying the first line morrolan Programming 4 03-07-2005 10:40 AM
problem with a simple script bash stockerz Linux - Newbie 1 09-21-2004 11:42 AM
Fairly simple bash problem xxx_Birdman_xxx Programming 5 06-16-2004 11:27 PM
Piping to ttoogg in bash script goofyheadedpunk Linux - General 8 06-06-2004 05:44 PM
simple bash problem xushi Programming 2 04-22-2004 07:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:09 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