Skip to content

Commit

Permalink
.aliases: Add chromekill to kill all Chrome tabs to free up memory
Browse files Browse the repository at this point in the history
Useful when you have a lot of tabs open (which I always do), but you don’t want to close them.

Tabs in Chrome are just processes, so we just filter out the ones we want, and kill them.

Closes #236.
  • Loading branch information
sindresorhus authored and mathiasbynens committed Aug 27, 2013
1 parent 3803a98 commit bd9429a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .aliases
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,7 @@ command -v grunt > /dev/null && alias grunt="grunt --stack"
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume 7'"
alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'"

# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"

11 comments on commit bd9429a

@addyosmani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

@passy
Copy link

@passy passy commented on bd9429a Aug 28, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

@rhiokim
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@hemanth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clap

@altryne
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@varun06
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sweet..let's pumpitup...

@tnguyen14
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work on both Chrome and Chrome Canary?

@mathiasbynens
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tnguyen14

Does it work on both Chrome and Chrome Canary?

Yes.

@kentcdodds
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@mathiasbynens
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, Opera 22+ users can go to Preferences and enable ‘Delay loading of background tabs’ instead. (In Opera 21 it was still a flag: opera://flags/#delay-onload.)

Then whenever you need to free up memory, just close Opera and re-open it. Tabs won’t be loaded until you focus them.

I believe Firefox has similar functionality.

@alrra
Copy link
Contributor

@alrra alrra commented on bd9429a Jun 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe Firefox has similar functionality.

From: http://blog.mozilla.org/theden/2013/05/01/5-top-tab-tips-for-firefox/

Don’t load tabs until selected: You can keep your Firefox running fast by selecting the “don’t load tabs until selected” option. Firefox will only load the active tab when it starts or restores your previous session. The other open tabs will be loaded as you click on them.

Preferences > Tabs > ✅ Don't load tabs until selected

Please sign in to comment.