Nicest way I can do this is to make an autoloaded function, say sudo_r:
function sudo_r { typeset comm=$(hist -nl ${@sudo_r:- -1 -1} | sed 1q); print -- $comm; sudo $comm; }
function sudo_r { typeset comm=$(hist -nl ${@:- -1 -1} | sed 1q); print -- $comm; sudo $comm; } Then (say) "alias ss=sudo_r". When this is done, you can type "ss cp"ss cp to repeat the last command beginning with "cp"cp, but prefixing it with "sudo"sudo. Or if you type ss <carriage_return>ss Return, it will sudosudo the previous command.