Kill command to ensure appium is not running

So I think sometimes appium is not gracefully closing on execution when i am running on my build server.
I was wondering if there is a simple command to ensure that no instance of appium is running in the background hogging the port?
At the moment i have a command to kill my simulator:

killall -9 “iPhone Simulator” &> /dev/null || true
killall -9 instruments &> /dev/null || true

Which makes sure the simulator is not running, what would be the command to do the same to appium?


normally you can use many appium instances. and your way kills ALL of them.

mine way:

cmd = new String{“sh”, “-c”, “lsof -P | grep ':” + USED_APPIUM_PORT + “’ | awk ‘{print $2}’ | xargs kill -9”};