Tuesday, October 6, 2009

show apps that are using an Internet connection

Thanks to commandlinefu (http://www.commandlinefu.com/commands/view/3543/show-apps-that-use-internet-connection-at-the-moment.)

To show a list of applications using an Internet connection, use the following commands:

$ lsof -P -i -N | cut -f l -d " " | uniq | tail -n =2 (only shows name of app)
or
$ lsof -P -i -n (shows more info, cleaner look imo)
or
$ ss -p (same result, less clean)
for one line per process:
$ ss -p | cat
for established sockets only:
$ ss -p | grep STA
for just process names:
$ ss -p | cut -f2 -sd\"
or
$ss -p | grep STA | cut -f2 -d\"

No comments: