kill traffic to port linux 1

kill traffic to port linux

sudo kill $(sudo lsof -t -i:PORTNUMBER)

# for example
sudo kill $(sudo lsof -t -i:80)

Here is what the above code is Doing:
1. sudo lsof -t -i:80
– sudo: run the command as root
– lsof: list open files
– -t: output just the PID (process ID)
– -i: list files for the specified Internet address
– :80: the port number
2. $(…)
– command substitution: run the command and substitute its output in place of the command
3. sudo kill …
– sudo: run the command as root
– kill: send a signal to a process
– …: the PID of the process to kill

Similar Posts