Imagine you're running some application, lets call it "foo", using an unix user shared with your work colleagues, and this application is also launched by them at the same time you're working. So along the time you may have several instances of this application, several processes with distinct PIDs. And all the sudden you need to kill all the instances that you previously launched but you need to avoid to kill the ones being used by your fellow colleagues. This is one way to do the trick.
Start by retrieving your tty (
teletypewriter),
bash$ tty
/dev/
pts/4And then kill the process "foo" for the current "tty" you're using,
bash$ kill `ps -le | grep
foo | grep "
pts/4" | cut -d" " -f6 `
PS: If know a way to include the retrieval of the tty inside the grep command let know =)