I have a command
lsof -i :3000
When I run it, I got this
⚡️lsof -i :3000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 6803 bheng 13u IPv6 0xa757c4ba1a0bf589 0t0 TCP *:hbci (LISTEN)
I want to create an alias of this command that takes a parameter as my port number.
I'm not looking to create a function or anything just for this.
I've tried
alias checkport='lsof -i :$1'
I want to use it like this
checkport 3000
Result
⚡️checkport 3000
lsof: unacceptable port specification in: -i :
lsof 4.89
latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
usage: [-?abhlnNoOPRtUvV] [+|-c c] [+|-d s] [+D D] [+|-f[cgG]]
[-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+|-M] [-o [o]] [-p s]
[+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.