Op 01-10-16 om 20:03 schreef Antoni V.:
> I use a command many times on a day to check what programs are using internet.
> netstat -lantp | grep -i stab | awk -F/ '{print $2 $3}' | sort | uniq
> Then I thought of making a shortcut for it called 'using'.
> I can think of 2 ways.
> 
> 1- add it to .mkshrc as \alias using=
> 2- create /usr/bin/using (chmod +x) and add the one liner to it
> 
> Both will work the exact same way.
> So I think, which one is better? Faster?

Making it an external command is fine; the speed difference is going to
be negligible in comparison to the pipeline of external commands you're
launching.

If you want to use .mkshrc, best use a shell function instead of an
alias. It avoids the shell-grammatical snags you get when you create an
alias out of a compound command. So add this to .mkshrc:

function using {
  netstat -lantp | grep -i stab | awk -F/ '{print $2 $3}' | sort | uniq
}

HTH,

- M.

Reply via email to