I recently began binging on Nightwatch through A&E’s website. My desktop and laptop both run Ubuntu, and I prefer to use Google Chrome for trusted websites because Firefox is loaded up with NoScript and AdblockPlus (it’s a pain to add constantly disable-enable both). However, A&E’s video player, on my machines, doesn’t get along with Google Chrome on Ubuntu (works just fine on Windows 10). As I’m watching the show, eagerly anticipating the next code 3 call, the video frame will freeze while the audio continues, and the browser just…. stops working. I can’t exit fullscreen, stop the video, or navigate out of the browser. The rest of the system works fine, but Google Chrome is stuck.
Here’s what Dan has to say about this:
I’ve never encountered this issue before on Ubuntu, but I’ve had friends come to me when it’s happened to them. My standard response is for them to Google a solution or to reboot, and the response I ordinarily get is that the proposed solutions they found on Google make no sense to them (understand that casual users don’t understand how to find a PID and running xkill through ctrl+alt+F2 is unhelpful if it asks for login credentials that are rejected when you enter your user password). Rebooting is also a pain because everything else that’s opened will be lost, and it takes a whole lot more time than ending the process. It also doesn’t help if Force Quit is nowhere to be found, and there’s no Task Manager equivalent.
Here’s what I do, and hopefully it helps you:
- Press Alt + Tab and navigate to Desktop
- Open Terminal by pressing Ctrl + Alt + T
- Type in killall chrome
Done! It’s closed! The solution to this problem beyond closing it every time is freezes is don’t use Google Chrome on websites where it does this. Cool!
Your instinct may be to use kill:
However, kill requires a process ID (PID). To get that PID, you might run ps -A:
This is obviously unhelpful because now you have a long, nasty list of every application’s PID. But we’re getting closer. We can clean this list up to show PIDs associated with Google Chrome by running ps -A and cleaning it up with grep. You can do this by combining the two commands using pipe “|“, which looks like this ps -A | grep chrome:
In a real-world situation where your browser is frozen, it’s certainly possible to run through this list and simply run kill on every PID listed for chrome. But… that takes time and it’s aggravating. Another way to represent the PIDs above is to use pgrep chrome, which generates a list of only the PIDs:
You can actually take the results returned from pgrep and pass it into kill, which in this case would be kill $(pgrep chrome). This will run kill on every PID generated from pgrep chrome.
For our purposes, there is no difference between kill $(pgrep chrome) and killall chrome. Both will pass the PIDs for Chrome into kill, and will close the browser. In this case, I used killall chrome as a recommendation because it looks nicer.
Point is, there are many ways to do the same thing. Perhaps the most unnecessarily complicated way of doing this would be to save the results of ps -A into a text file and then parse that text file for the PIDs associated with Chrome, and to pass the PIDs I parsed out into kill. That could be done and it would work…. or I could run killall chrome. Remember what you’re trying to do and what the context is.