This question already has an answer here:

I am trying to create some alias for executing the same command but with sudo credentials. In the ultimate case I want to be something like:

alias !!='sudo !!'

But when I source /.bashrc file this particular alias doesn't work for some reason.

marked as duplicate by Kusalananda Mar 29 at 8:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


aliases cannot have arguments, use a function:

function SU { sudo $*; }
  • when you say aliases cannot have arguments, are you saying something like alias l="ls -FC" is invalid? – ron Feb 23 '17 at 18:28
  • The alias in your example is l. Sure, it use arguments but itself has none. Try to define a alias for a find -user self -print with a directory as argument. – ingopingo Feb 23 '17 at 18:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.