Im always running a particular app as root because it requires more privileges.I usually just sudo it.I want to make an alias that is something similar to:alias myCmd='sudo nohup /path/to/binary > /dev/null 2>&1 &'The problem arises when sudo prompts for password and then nothing will happen actually.How can it be done?
Alias that runs a command using sudo
sudo;alias
Use a shell script instead of an alias.in ~/.bashrc:export PATH=$PATH:~/binyour script in ~/bin/runthat:#!/bin/bashsudo nohup /path/to/binary > /dev/null 2>&1 &Then to run it, just do it like:$ runthatOr if you skipped the PATH step, then run it like:$ ~/bin/runthatIf this is a system-wide (all users) script instead of just you, then put it in /usr/local/bin instead.Or also you could use a function. eg. in ~/.bashrc:runthat() {    sudo nohup /path/to/binary > /dev/null 2>&1 &}Also just FYI and not a direct answer to the question, another alternative is to put it in the sudoers file:sudo visudo    (your editor pops up here)    username ALL=NOPASSWD: /path/to/binaryAnd now it won't ask for a password at all. (which means lower security... maybe some security exploit will now let malware run this app too... so make sure you accept that small risk)