Adding shortcuts to command lines

Linux command lines can be long-to-type and difficult-to-remember. Sometimes it is really helpful to create aliases (a.k.a, shortcuts) for frequently used commands or combination of commands that you’ll use in your OpenAPS rig. Here’s a short set of instructions for setting up aliases. You can customize the initial list of aliases however you’d like.

By setting up these aliases, you can just use the shortcut command while logged into your rig instead of typing out the much longer version of the command. For example, typing cat-pref will show you a print out of your preferences.json file. Typing edit-wifi will bring up your wpa-supplicant file so that you can add or edit wifi networks for your rig.

  • Create a blank profile
    nano ~/.bash_profile
  • Copy and paste (or make your own aliases) the following aliases into the blank profile
alias autosens-loop="tail -n 100 -F /var/log/openaps/autosens-loop.log"
alias autotune="tail -n 100 -F /var/log/openaps/autotune.log"
alias ns-loop="tail -n 100 -F /var/log/openaps/ns-loop.log"
alias pump-loop="tail -n 100 -F /var/log/openaps/pump-loop.log"
alias cat-pref="cd ~/myopenaps && cat preferences.json"
alias edit-wifi="vi /etc/wpa_supplicant/wpa_supplicant.conf"
alias cat-wifi="cat /etc/wpa_supplicant/wpa_supplicant.conf"
alias edit-pref="cd ~/myopenaps && vi preferences.json"
alias log-wifi="tail -n 100 -F /var/log/openaps/network.log"
alias git-branch="cd ~/src/oref0 && git branch"
alias cat-autotune="cd ~/myopenaps/autotune && cat autotune_recommendations.log"
alias edit-runagain="cd ~/myopenaps && nano"
alias cat-runagain="cd ~/myopenaps && cat"

Exit the nano editor by pressing control-x, then typing y to save file, and then return to save with same file name.

  • Tell your rig to use this profile (note: this command will need to be done after each update to the profile too, or the new aliases won’t be activated until you reboot)
    source ~/.bash_profile