Stop A Program From Running On Startup (Command Line On Ubuntu)

You can stop a program from running on startup in Ubuntu (this is confirmed to work on Ubuntu 18.04) by using the ‘systemctl disable‘ command, following by the name of the service you would like to disable. You may need to run that commands with sudo.

NB: Stopping certain programs from running on startup may affect the stability of your PC or cause malfunctions. Please be cautious and proceed at your own risk.

Two common examples are:

Stop MongoDB from running on startup:

sudo systemctl disable mongodb

To stop PostgreSQL from running when Ubuntu starts:

sudo systemctl disable postgresql

Stopping programs from running on startup can reduce your computer’s startup time considerably and improve overall performance by eliminating the unnecessary memory usage of those programs. Many programs occupy RAM even if they aren’t in use.

This method may also work on other Linux distributions that use ‘systemd’. While the above method will stop services from running when Ubuntu starts up, other programs may be scheduled to run via cron jobs or ‘rc.local’, especially if they are binaries that were installed via other means.

If the command above doesn’t work, use crontab to check if there is a cron job starting that program up. That would be denoted by a line that starts with ‘@reboot’.

crontab -e

After running this command, select your preferred console text editor (Nano is straightforward) and look for something like ‘@reboot program_name’.