How to close Android Studio using terminal in Ubuntu
pkill java
Is the easiest one.
EDIT
Many people have made use of the command above, however, there is a drawback to using it: All Java applications running as your user will be killed.
To fix this, I've made a oneliner which will kill one Android Studio instance. This may or may not work on your particular system but is a better solution than the one mentioned above if it happens to work for you.
ps -eo pid,cmd | grep -Ev "^ {0,1}([0-9]*) grep.*" | grep -E 'java.*android-studio' | sed -re 's/ {0,1}([0-9]*) .*/\1/' | head -n1 | xargs kill -9
This will search for java.*android-studio
in the commands of your process list and kill the associated process using its PID.
killall -9 java
It works for me.