{"id":20450,"date":"2023-08-31T14:50:36","date_gmt":"2023-08-31T14:50:36","guid":{"rendered":"https:\/\/linuxways.net\/?p=20450"},"modified":"2023-08-31T14:50:36","modified_gmt":"2023-08-31T14:50:36","slug":"how-to-install-netstat-on-debian-12","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-install-netstat-on-debian-12\/","title":{"rendered":"How to Install netstat on Debian 12"},"content":{"rendered":"<p><strong>Debian 12<\/strong> is the latest release of Debian and is compatible with numerous desktop applications such as GNOME 43, LXDE 11, etc. <strong>netstat <\/strong>is a commonly used CLI tool that is available for a variety of operating systems such as Linux, Windows, MacOS, etc. It can be installed and used on Debian 12 to perform certain operations.<\/p>\n<p>In this article, the step-by-step process of installing netstat on Debian 12 will be discussed.<\/p>\n<h2><strong>What is netstat?<\/strong><\/h2>\n<p><strong>netstat <\/strong>is an acronym for <strong>network statistics<\/strong>. It is a CLI (Command Line Interface) tool used for displaying the current network connections and port activity on our computer.<\/p>\n<h2><strong>How to Install netstat on Debian 12?<\/strong><\/h2>\n<p>The installation of netstat is an easy and smooth process. In order to install netstat on Debian 12 we have to install net-tools using the \u201c<strong>sudo apt install net-tools<\/strong>\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> net-tools<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"403\" class=\"wp-image-20451\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-1.png 788w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-1-300x153.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-1-768x393.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/><\/strong><\/p>\n<p>Once the above command is executed successfully, we can confirm its installation by using the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">netstat<\/span><\/div><\/div>\n<p>netstat is working completely fine as we can see below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"444\" class=\"wp-image-20452\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-2.png 783w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-2-300x170.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-2-768x435.png 768w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><\/p>\n<p>From the above snippet, it can be seen that netstat command retrieved six columns, whose details are illustrated below:<\/p>\n<ul>\n<li><strong>Proto <\/strong>describes the connection protocol.<\/li>\n<li><strong>Recv-Q<\/strong> displays the data possessed in the receiving sequence.<\/li>\n<li><strong>Send-Q<\/strong> displays the data possessed in the outbound sequence.<\/li>\n<li><strong>Local Address<\/strong> retrieves the IP Internet Protocol Address.<\/li>\n<li><strong>Foreign Address <\/strong>demonstrates the IP (Internet Protocol) address to whom we are connected.<\/li>\n<li><strong>State<\/strong> prints the connection state.<\/li>\n<\/ul>\n<h2><strong>How to Use the netstat Command?<\/strong><\/h2>\n<p>netstat is used to display the status of the connected network. It can be executed with different options to achieve a specific functionality. Following are the list of netstat commands that we can use:<\/p>\n<ul>\n<li>netstat -n<\/li>\n<li>netstat -ie<\/li>\n<li>netstat -u<\/li>\n<li>netstat -p<\/li>\n<li>netstat -a<\/li>\n<li>netstat -s<\/li>\n<li>netstat -st<\/li>\n<li>netstat -su<\/li>\n<li>netstat -r<\/li>\n<li>netstat -g<\/li>\n<\/ul>\n<h3><strong>Example 1: How to Exhibit Active Internet Connections?<\/strong><\/h3>\n<p>\u201c<strong>netstat -n<\/strong>\u201d is used to exhibit the active Internet connections as shown below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-n<\/span><\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"443\" class=\"wp-image-20453\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-3.png 777w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-3-300x171.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-3-768x438.png 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/strong><\/p>\n<h2><strong>Example 2: How to Display the Kernel Interface Table?<\/strong><\/h2>\n<p>To display the kernel interface table we use \u201c<strong>netstat -ie<\/strong>\u201d as shown in the snippet below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-ie<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"228\" class=\"wp-image-20454\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-4.png 720w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-4-300x95.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<h2><strong>Example 3: How to Get the Status of TCP\/IP Connections?<\/strong><\/h2>\n<p>To print the status of TCP\/IP connections \u201c<strong>netstat -u<\/strong>\u201d is used:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-u<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"757\" height=\"89\" class=\"wp-image-20455\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-5.png 757w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-5-300x35.png 300w\" sizes=\"auto, (max-width: 757px) 100vw, 757px\" \/><\/p>\n<h2><strong>Example 4: How to Get all IPv4 Connections?<\/strong><\/h2>\n<p>\u201c<strong>netstat -p<\/strong>\u201d retrieves all the active IPv4 (Internet Protocol Version 4) connections:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-p<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"446\" class=\"wp-image-20456\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-6.png 786w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-6-300x170.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-6-768x436.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/p>\n<h2><strong>Example 5: How to Get the State of All Sockets?<\/strong><\/h2>\n<p>\u201d<strong>netstat -a<\/strong>\u201d is used to demonstrate the state of all sockets including both TCP and UDP:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-a<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"782\" height=\"279\" class=\"wp-image-20457\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-7.png 782w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-7-300x107.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-7-768x274.png 768w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/p>\n<h2><strong>Example 6: How to Display the Statistical Summary of All Protocols?<\/strong><\/h2>\n<p>\u201c<strong>netstat -s<\/strong>\u201d illustrates the statistical summary for each of the available protocols:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-s<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"491\" height=\"404\" class=\"wp-image-20458\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-8.png 491w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-8-300x247.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/p>\n<h2><strong>Example 7: How to Print TCP Statistics?<\/strong><\/h2>\n<p>\u201c<strong>netstat -st<\/strong>\u201d prints the statistics of TCP (Transmission Control Protocol):<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-st<\/span><\/div><\/div>\n<p>\u2018 <img loading=\"lazy\" decoding=\"async\" width=\"427\" height=\"361\" class=\"wp-image-20459\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-9.png 427w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-9-300x254.png 300w\" sizes=\"auto, (max-width: 427px) 100vw, 427px\" \/><\/p>\n<h2><strong>Example 8: How to Illustrate UDP Statistics?<\/strong><\/h2>\n<p>Similar to the above command, \u201c<strong>netstat -su<\/strong>\u201d returns the statistics of UDP (User Datagram Protocol):<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-su<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"300\" class=\"wp-image-20460\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-10.png 411w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-10-300x219.png 300w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/p>\n<h2><strong>Example 9: How to Print the Route Table?<\/strong><\/h2>\n<p>\u201c<strong>netstat -r<\/strong>\u201dretrieves the route table:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-r<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"109\" class=\"wp-image-20461\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-11.png 733w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-11-300x45.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<h2><strong>Example 10: How to Display All IPv6 Connections?<\/strong><\/h2>\n<p>\u201c<strong>netstat -g<\/strong>\u201d displays the IPv6 (Internet Protocol Version 6) information:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">netstat<\/span> <span class=\"re5\">-g<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"320\" class=\"wp-image-20462\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-12.png 498w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20450-12-300x193.png 300w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/p>\n<p>That\u2019s all about installing and using netstat command on Debian 12.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>To install netstat on Debian 12, first, open the terminal, and execute the \u201c<strong>sudo apt install net-tools<\/strong>\u201d command. Then to verify its installation, execute the \u201c<strong>netstat<\/strong>\u201d command. Afterward, we can use commands like \u201c<strong>netstat -u<\/strong>\u201d, \u201c<strong>netstat -s<\/strong>\u201d, etc. to demonstrate the functionality of these commands. In this write-up, we have given a demonstration of how to install netstat on Debian 12.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>To install netstat on Debian 12, open the terminal, and execute the \u201csudo apt install net-tools\u201d command. To verify its installation, run \u201cnetstat\u201d command.<\/p>","protected":false},"author":110,"featured_media":20463,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-20450","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/20450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=20450"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/20450\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/20463"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=20450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=20450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=20450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}