Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Commands»How to Kill a Process Running on Specific Port

    How to Kill a Process Running on Specific Port

    RahulBy RahulNovember 6, 20191 Min ReadUpdated:November 15, 2019

    The Linux operating system consider everything as file. So first of all, use lsof (List of Open Files) Linux command to identify the process id (PID) of running process on any port. The you can use kill command to kill that process using the PID.

    Kill Process on Port

    For example, you need to kill process running on port 3000.

    sudo kill -9 $(sudo lsof -t -i:3000)
    

    Explanation

    First “sudo lsof -t -i:3000” will return the PID of the process running on port 3000.

    lsof -t -i:3000
    
    6279
    

    The above result shows 7279 is the PID of the process on port 3000. Now you can use kill command to kill the process.

    sudo kill -9 6279
    
    kill lsof pid process
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Python 3.8 on Amazon Linux
    Next Article How to Install and Configure Apache on Debian 10

    Related Posts

    How to Search Recently Modified Files in Linux

    2 Mins Read

    Bash Printf Command

    Updated:December 23, 20212 Mins Read

    Tee Command in Linux with Examples

    4 Mins Read

    How to Scan Open Ports with Nmap

    5 Mins Read

    Handling filenames with spaces in Linux

    3 Mins Read

    How To Compare Two Files in Linux

    Updated:August 23, 20215 Mins Read

    1 Comment

    1. Alvin on July 18, 2021 6:22 am

      fuser -n tcp -k #
      #means port number

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.