Andrew Fletcher published: 4 August 2022 2 minutes read
Listen in on the ports being used on your server. To do so, run the command
netstat -a | grep tcp
If netstat is not install, then you'll be prompted to run the install script
sudo apt install net-tools
Response
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
net-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 196 kB of archives.
After this operation, 864 kB of additional disk space will be used.
Get:1 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 net-tools amd64 1.60+git20180626.aebd88e-1ubuntu1 [196 kB]
Fetched 196 kB in 1s (332 kB/s)
Selecting previously unselected package net-tools.
(Reading database ... 96037 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb ...
Unpacking net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Setting up net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Run netstat again
This time the response is
tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN
tcp 0 0 localhost:37609 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:http 0.0.0.0:* LISTEN
tcp 0 0 localhost:http-alt 0.0.0.0:* LISTEN
tcp 0 0 localhost:6379 0.0.0.0:* LISTEN
tcp6 0 0 [::]:8983 [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 ip6-localhost:6379 [::]:* LISTEN
Or using
sudo netstat -ltnp
Generates the response
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1006/postgres
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 681/systemd-resolve
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 769/python3
tcp 0 0 127.0.0.1:37609 0.0.0.0:* LISTEN 1235/uwsgi
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 830/sshd: /usr/sbin
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 17560/nginx: master
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 1235/uwsgi
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 919/redis-server 12
tcp6 0 0 :::8983 :::* LISTEN 740/java
tcp6 0 0 :::22 :::* LISTEN 830/sshd: /usr/sbin
tcp6 0 0 :::80 :::* LISTEN 17560/nginx: master
tcp6 0 0 ::1:6379 :::* LISTEN 919/redis-server 12
Related articles
Andrew Fletcher
•
18 Apr 2024
No results showing for your Solr instance - solr.service: Failed with result 'exit-code'
When Solr is displaying results on the site, first step is to log in the server and check its status● solr.service - LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/init.d/solr; generated)
Active: failed (Result: exit-code) since Wed 2024-04-17 23:22:52 UTC; 6h ago
...
Andrew Fletcher
•
18 Mar 2024
Resolving CVE-2022-48624 less issue
To resolve the CVE-2022-48624 vulnerability on Ubuntu using Nginx, it's crucial to understand that the issue lies within the "less" package, not Nginx itself. The vulnerability affects "less" before version 606, where close_altfile in filename.c in less omits shell_quote calls for LESSCLOSE,...
Andrew Fletcher
•
06 Mar 2024
Terminal command to find and replace
In many terminal text editors, you use find command as reference in Terminal commands - find. How about find and replace. This action depends on the specific text editor you're using in the terminal. Here are a few common terminal text editors and how you can find and replace...