03-08-2024, 10:50 PM
I need assistance with an issue I'm facing on my Ubuntu server. I have a process that's using port 9001, and I need to terminate it. I've attempted to use lsof to find the process ID and then pass it to kill, but it seems that I'm making a syntax error. Here's what I have so far:
This command gives me the process ID, which is what I want. But when I use the following command to kill it:
I receive an error message complaining about an "ERROR: garbage process ID." What is the correct way to pipe the output from lsof directly into kill? I'm certain that there's a simple mistake in my command. Here is the exact error message for reference:
Code:
sudo lsof - t - i: 9001
This command gives me the process ID, which is what I want. But when I use the following command to kill it:
Code:
sudo kill 'sudo lsof -t -i:9001'
I receive an error message complaining about an "ERROR: garbage process ID." What is the correct way to pipe the output from lsof directly into kill? I'm certain that there's a simple mistake in my command. Here is the exact error message for reference:
Code:
Usage:
kill pid...Send SIGTERM to every process listed.
kill signal pid...Send a signal to every process listed.
kill - s signal pid...Send a signal to every process listed.
kill - l List all signal names.
kill - L List all signal names in a nice table.
kill - l signal Convert between signal numbers and names.