This is in Linux.

I'll start by saying that the only root-privileged user in /etc/sudoers is root.

I like to run netstat to see what my computer is talking to. To see the PID/Program name it needs root privlidees, and, to do that easily, I use sudo. To do it quickly, I run rns in a terminal.

To provide the sudo, the file:

 /etc/sudoers.d/rns
containing:
 User_Alias NSERS=tom
 Cmnd_Alias NS=/usr/bin/rns
 NSERS ALL=NOPASSWD: NS

An alias in /home/tom/.bashrc

 alias rns="sudo /usr/bin/rns"

/usr/bin/rns is executable and contains:

 #!/bin/bash
 t-nsloop() {
 x=1
 while [ $x -le 4 ]
 do
  netstat -antpu
 echo "#############     #############     #############"
 sleep 5
 x=$(( $x + 1 ))
done
clear
sleep 2
t-nsloop
}
t-nsloop

So, I open a terminal, rns and Enter gets a looping netstat-as-root display. It loops five times, then clears and loops five times again, continuing until I Crtl- c.