centos who connected to server 1

centos who connected to server

netstat -an | grep ESTABLISHED

Here is what the above code is Doing:
1. We’re using the subprocess module to run the netstat command.
2. We’re using the grep command to filter the output of netstat.
3. We’re using the pipe operator (|) to pass the output of netstat to grep.
4. We’re using the -an option to netstat to print all connections and listening ports.
5. We’re using the -E option to grep to use extended regular expressions.
6. We’re using the ESTABLISHED keyword to grep to filter the output of netstat.

Similar Posts