Automatically power off Ubuntu after a given period of time. Open the terminal window and get temporary root privileges. sudo -iCopy When asked, type your password. Your password will not be displayed in any way, even as dots, and this is normal. After you have typed the password, press Enter again. Now you need to calculate for how many seconds the computer should be running before shutdown. For example, if you want a computer to work for the next half an hour, you will have to use the number of seconds calculated this way: 30 x 60 = 1,800 seconds. Type the command: sleep 1800 && shutdown -h nowCopy For the command to be performed, don’t close the terminal window and press Enter. As a result, your computer will shut down automatically in 30 minutes.