I am trying to create an alias for the following command
lsof -i :$1 | awk 'NR!=1 {print $2}' | xargs kill
However I keep getting an error:
lsof: unacceptable port specification in: -i :
I tried different things but I keep failing to pass the port number successfully. How can I pass the port number into this alias?
If you need to pass a parameter into a specific position, an alias cannot be done. Instead, create a function:
If you save it in your
~/.bashrc
file you will be able to call it withmyfunc parameter
.