This question already has an answer here:

I need to run a simple batch of commands after the computer boots, something like

sudo thing
sudo thing1 -p

But for the life of me I can't figure out how. I googled and googled and I kept finding the same thing: Place the commands into a /etc/rc.local or /etc/init.d/rc.local file. The problem is that none of those files exist on my system! Furthermore, I have read that /etc/rc.local is deprecated anyway, so what the correct and simple way to do this?

I would like to know how to these two things:

  • run a command after the computer boots
  • run a command after specified user logs in, and run it as the given user

    (And make all that happen solely by editing stuff in the terminal, no GUI tools)

Thank you.

marked as duplicate by dessert command-line May 29 '18 at 7:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.