A daily routine of cd’ing in a directory and starting a server can easily be automated.
How to shortcut on Linux
- Save your script wihtout ending i.e. as “x” in any dir
Best create a new folder for your custom scripts i.e.
cd /home/dome/app && rails s -b 0.0.0.0
- Add permanent path to .bashrc file
Exit file and save with ctrl+x, then confirm with y.
- Add missing permissions with
sudo chmod a+rwx /home/dome/mycommands/x
- Ready! Now when executing your script as source (the dot) by typing
it will cd and start the rails server.