Jay's blog

I'm tired of typing "systemctl --user"

I chose to alias systemctl --user since I use it so often. That's not blog post-worthy. What makes it so is that I didn't want to lose tab completion when using my alias.

# Add this to your .bashrc

alias scu='systemctl --user'
_completion_loader systemctl
function _scu_complete() {
    COMP_WORDS=(systemctl --user "${COMP_WORDS[@]:1}")
    (( COMP_CWORD++ ))
    _systemctl
}
complete -F _scu_complete scu

This little snippet ensures that tab completion still functions on the new scu alias.

I'll still type out systemctl --user when appropriate in my documentation, but you best believe I'm going to be using scu all the time besides.

#bash #systemd