In versions prior to 58, a killall chromium-browse[r] was sufficient to kill all tabs while leaving the browser chrome intact. How can this behavior be replicated for the new version of the browser?
The best I've managed is the following which will also take out extensions when doing its thing:
pgrep -f 'chromium-browser --type=renderer' | while read pid; do kill $pid; doneEdit for context: I have the amount of memory that chromium may use restricted by cgroups. When that amount is exceeded, chromium hangs swapping memory from and to disk. Chromium does not respond to user input when in this state, so browser-based tab control is not an option.
Edit for clarity: Killing a tab does not imply closing it. What I want is for the tab itself to remain, but the rendering process to die. This is usually indicated by displaying a "Something went wrong" message instead of normal tab content.
32 Answers
Okay so after your edits; I played around with the command you gave. You said that it destroys extensions as well so to exclude them you can do grep -v "extension" but then you take as input the whole process command.
Anyways. First select the process name
pgrep -f -a 'chrome'I'm using chrome, you can put chromium-browser instead. The -a flag here is important.
then do
| grep 'type=renderer'to get all renderers. Then do
| grep -v "extension"to exclude the extensions, then we need to do
| egrep -o '^[0-9]{0,}'to get only the process number (since we had to use the -a flag which gives extra data in the string).
Feed that into your for loop
| while read pid; do kill $pid; doneAnd it should kill renderers without extensions
So finally, here's the whole thing for you:
pgrep -f -a 'chromium-browser' | grep 'type=renderer' | grep -v "extension" | egrep -o '^[0-9]{0,}' | while read pid; do kill $pid; doneI hope I didn't make mistakes
3Ctrl + Shift + w will kill all tabs in the currently selected chrome window without affecting the browser itself.
4