1
October
2024
17:40

Identifying processes that access the Internet

1 October 2024 17:40

Noticed in netstat -a that connecting to the Internet from background processes. Then I found and deleted the package that accessed the Internet.

List of processes that connect to the Internet

Classic netstat program:

netstat -tpn -W

or

netstat -tun -W

or

netstat -tUn -W

where

p - display the program name
t-TCP
u - UDP
n - display numeric IP addresses instead of host names
U - UDP lite
W - output information in wide format (Wide)

ss program - extended information:

ss -4 -e

or

ss -6 -e

or

ss -u -e

where:
-4 (alias -f inet) - display the class of Internet connections using the IPv4 protocol
-6 (alias -f inet6 - display the class of Internet connections using the IPv6 protocol
-u - output UDP
-n - port numbers are numeric instead of alphabetic (for example, 67 instead of bootp)
-e - display extended information.

Determining package name by process name

For user context programs, you can often determine the package name by name.

Find a package by name

Finding a package using dpkg by pattern

dpkg -l 'package_name*'

where:

package_name - package name

The program will display the status of package ii - package installed, rp - deleted, configuration file left.

Removing a package by name (without deleting configuration files)

sudo dpkg -r 'package_name'

Complete removal of a package by name, with removal of configuration files

sudo dpkg -P 'package_name'

where:

'package_name' is the exact name of the package.


Source:ru.linux-console.net



Related publications