14

I need a way to kill my battery in my Ubuntu laptop. Is there any mind numbing tasks I can Ubuntu do that will eat up the battery? I have already shut off the power management options.

The battery is giving my issues and and someone said I should discharge it fully an recharge it from 0.

9
  • 7
    As an aside, it is possible that this someone has no idea what they are talking about. You can't really "reboot" a battery, and while I'm no HW expert, discharging a battery to 0 sound kind of unhealthy for it, to be frank. Jul 16, 2011 at 20:54
  • @Williham is correct. Laptop batteries should never be brought below approximately 40% charge. It's very bad for them. Some people say you can have a complete discharge cycle every 100-300 charge cycles, though.
    – Reid
    Jul 16, 2011 at 21:44
  • @Reid: Surely that's can, and not should? Jul 16, 2011 at 21:48
  • 1
    I've heard of this related to "recalibrating" the battery. E.g., tech-no-media.com/2009/07/how-to-extend-lithium-ion-laptop.html
    – LawrenceC
    Jul 17, 2011 at 3:09
  • 1
    Here's another interesting article on Li-Ion life: batteryuniversity.com/learn/article/… - the takeaway is pretty much 1. battery life will degrade over time and 2. " Partial discharge on Li-ion is fine; there is no memory and the battery does not need periodic full discharge cycles other than to calibrate the fuel gauge on a smart battery"
    – Kris C
    Jul 17, 2011 at 8:47

5 Answers 5

18

apt-get install stress - a utility specifically designed for testing CPU and other functions. You can use it to peg your CPU at 100% usage until the battery dies.

I'm not sure what options exist to peg GPU usage at 100%.

You should drop to runlevel 1 and dismount all volumes possible since your system will not shutdown smoothly.

3
  • 7
    Another option would be to use a livecd such as stresslinux.org
    – Nifle
    Jul 16, 2011 at 20:33
  • 1
    i like the idea of a live cd because the machine will just stop and wont hurt the drives. Jul 16, 2011 at 21:40
  • 1
    I could not get the stresslinux to start on the laptop, so I just ran memtest 86+. That worked fine, I am interested in trying out that stress linux though. Thanks Jul 18, 2011 at 0:29
5

Simply run:

while :; do :; done

In a terminal. That is an infinite do-nothing loop that will increase CPU usage to ~100% for one core. You could repeat this 4 times in parallel if you have a quad-core processor, but on the few laptops I've tested this on, it hasn't increased battery drain.

In addition: Increase screen brightness to full, blast music at max volume, ensure WiFi is on, and plug in as many power draining USB devices as you can: Phones, hard drives, etc.

This should kill most laptops in under 2 hours.

3
  • I received syntax error
    – user
    Jul 7, 2021 at 13:54
  • $ while :; do done bash: syntax error near unexpected token `done'
    – user
    Jul 7, 2021 at 13:54
  • 1
    @user: Thank you. Fixed
    – Zaz
    Jul 24, 2021 at 19:20
3

Run lots of Virtual Machines

Do a full ls -Rlath /

Try to find a string of text within every file on the disk

Fun full screen games

0

To find out how long it actually ran, I tend do start this little bash script, then start a 10-hour Youtube video or the like (modern browsers like Firefox often disable power management when playing videos):

while true
do
  date >> test.log
  sync
  sleep 60
done

This will write a timestamp to "test.log" every minute and assure it gets written to disc, so I can check how long the system ran afterwards.

-1

Try fork bomb in shell:

:(){ :|: & };:

however you've big changes to crash your laptop instead, so run at your own risk. I'm sure it'll keep your laptop busy until the battery is dead.

1
  • 2
    Wastes memory, not CPU.
    – Zaz
    Jun 6, 2017 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .