I want to run a simple command after boot.

cd /mypath
# then

How can I do it?


1 Answer 1


Two solutions:

The first one is to put the full path of the command in /etc/rc.local:


or, the cron way:

crontab -e

@reboot cd /mypath;./mycommand

From the crontab manual:

 @reboot        Run once, at startup.
  • /etc/rc.local is available for 16.04, but 17.10 and 18.04 aren't at least you make it available for systemd.
    – Néstor
    Nov 13, 2018 at 15:37

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