Skip to content
Advertisement

How to end a process in another linux terminal

Background Info:

  • I’m trying to set up a remote display using a raspberry pi.
  • Currently I’m using fbi (frame buffer image viewer) to display the image.
  • The device is going to be controlled via ssh or web interface – not sure which, but definitely not from the actual device.

The Problem is I cant seem to find an easy way to “clean” quit the process remotely, clear the screen & generate no errors. The fbi program will exit if the q button is pressed but that seems to do no good over ssh. Ideally I’d prefer a less messy solution then having to look up the pid each time before killing it. I am open to the idea of using another program, however I can’t run it in Xorg.

I’ve tried:

  • Grep-ing the pid and sending kill -sigterm but it either doesn’t quit or doesnt clear the screen
  • echo "q" > /proc/[pid]/fd/0 – all the iterations i try I either get an access denied or nothing happens

Any Ideas?

Advertisement

Answer

How to kill a process without a message?
In one terminal, I started a process:

# sleep 100

Now to kill the process, without a message and without knowing the pid:

# kill -13 (pgrep sleep)

How to remotely clear the screen of a terminal?
First, get the tty # of the terminal you want to clear:

# tty
/dev/pts/1

Now from a different terminal:

# printf '33c' > /dev/pts/1
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement