1
. x

A daily routine of cd'ing in a directory and starting a server can easily be automated.

How to shortcut on Linux

  1. Save your script wihtout ending i.e. as “x” in any dir Best create a new folder for your custom scripts i.e. /home/dome/mycommands/
1
2
3
4
5
#!/bin/bash
function startr(){
cd /home/dome/app && rails s -b 0.0.0.0
}
startr
  1. Add permanent path to .bashrc file
1
nano ~/.bashrc

add line:

1
export PATH=$PATH:/home/dome/mycommands

Exit file and save with ctrl+x, then confirm with y.

  1. Add missing permissions with
1
sudo chmod a+rwx /home/dome/mycommands/x
  1. Ready! Now when executing your script as source (the dot) by typing
1
. x

it will cd and start the rails server.