Z
Z
Zorgios2021-08-18 11:37:22
linux
Zorgios, 2021-08-18 11:37:22

How to replace searching for a process and terminating it with one command?

I complete the process like this:

sudo netstat -nlp | grep 5000
kill -9 7800 (id процесса)


The process is always the same, there will be no conflicts.
sudo netstat -nlp | grep 5000
Returns this: Is it
611cc6b4f192b524885954.png

possible to replace these 2 commands with one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xibir, 2021-08-18
@Zorgios

kill -9 `lsof -ti:5000`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question